----- Original Message -----
From: "Gary" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, October 27, 2002 2:00 PM
Subject: [PHP] defining a variable


> Hi All,
>    I am have trouble getting  $address to print the URL that is in the db.
> <td class=\"dtd\"><a href=\"$address\" target=\"_blank\">%s</a></td> is
> printing the url with the word address instead of the real address.
>
> The code is below.
>
>   $sql ="SELECT * FROM links ORDER BY owner";
>             $sql_result = mysql_query($sql, $conn) or die ("couldn't
> Connect");
>
>         while ($myrow = mysql_fetch_array($sql_result)){
>    $address = 'address';
^^^^^
That's what you asking for here.

Perhaps you're meaning to do a:
   printf("
    <tr>
     <td class=\"dtd\"><a href=\"%s\" target=\"_blank\">%s</a></td>
     <td class=\"dtd\">%s</td>
     <td class=\"dtd\">%s</td>
   </tr>\n",
   $myrow['address'],
   $myrow['tutorial'],
   $myrow['owner'],
   $myrow['category']);
}while ($myrow = mysql_fetch_array($sql_result));

Don't just try to change 'address' to $row['address'] abve, because you
haven't fetched the result yet, and it will be blank everytime.  It needs to
be in the fetch() loop.



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

Reply via email to