Re: Problem with passing variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- Original Message ----- 
From: "Phil Matt" <philm@xxxxxxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Sent: Tuesday, January 27, 2004 17:08
Subject:  Problem with passing variables


> Hello to all.
>
> I am a relative newcomer to PHP. I am trying to pass the value of a
variable from a
> MySQL database from one PHP page to another PHP page. On the first page,
I've made
> the connection to the database, and the query works just fine, displaying
the correct
> values from the $myrow fields.
>
> This is the code to that point:
>
> <?
> $db = mysql_connect("ip address here","user here","password here") or die
("Unable to
> connect to SQL server");
> mysql_select_db("databasename",$db);
> ;
> $result= mysql_query("SELECT * FROM databasename WHERE ID<20",$db);
> echo'<table>
>
<th><tr><td>Name</td><td>Title</td><td>Phone</td><td>E-mail</td></tr></th>';
> while ($myrow = mysql_fetch_row($result)){
> echo'<tr>
> <td>'. $myrow[0].'</td>
> <td>'. $myrow[1].'</td>
> <td>'. $myrow[2].'</td>
>
> This works just fine. Then I try to pass the variable $myrow[0] to a
second page, where
> the value of the variable (a string that contains a name) is supposed to
appear. Here's
> the line of code:
>

*Maybe this will help. I'll presume the next statement is not included in a
print command
> <td><a href="email.php?recip=$myrow[0]"><img src="graphics/mail.gif"
class="imglink"

use ....?recip=<?=$myrow[0]?>">.....


> alt="Click to send mail to this person" /></a></td></tr>';
>
>
> The page receiving this variable, email.php, uses this to retrieve the
value of $myrow[0]:
>
> Send e-mail to <?php $recip=$_GET['recip']; echo "$recip"; ?>
>
>
> However, all this manages to do is to print out this:
>
> Send e-mail to $myrow[0]
>
> Instead of the VALUE contained in the variable!
>
> What am I doing wrong?
>
> TIA --- Phil Matt
>
>
>
>
>
>
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux