Re: Question about displaying MySQL entries
| From: | Carroll Barrett | Date: | Tue, 27 Jun 2000 14:17:33 +0000 |
| Subject: | Re: Question about displaying MySQL entries | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-3342@lists.php.net to get a copy of this message | ||
Tyler,
You have to move your closing brace ( } ) as noted below. You
are looping through your result correctly (it seems to me), but
you do not attempt to display anything until you have reached the
last row in the result.
Regards,
Carroll Barrett
<?
$connection = mysql_connect("localhost","user239","F0AA2pa8") or
die ("Unable to connect to server.");
$db = mysql_select_db("cr0n", $connection) or die ("Unable to
find requested database.");
$result = mysql_query("select * from user_code WHERE language
like 'perl'");
while($row = mysql_fetch_array($result)) {
$description = $row["description"];
$type = $row["type"];
$id = $row["id"];
$language = $row["language"];
$author = $row["name"];
$date = $row["date"];
} <============move this line to.... (see end of your code)
echo "<table width=75% align=center bgcolor=#000000 cellpadding=0
cellspacing=0><tr><td bgcolor=#000000><table width=100% border=0
cellspacing=1 cellpadding=1 height=0%>
<tr>
<td height=15 bgcolor=#000000 colspan=2><A
href=\"viewcode.php?id=$id\"><font size=-1 color=#FFFFFF
face=Arial, Helvetica, sans-serif>$description</font></a></td>
</tr>
<tr>
<td bgcolor=#4A5A63 valign=top width=50% height=23>Author:
$author</td>
<td bgcolor=#4A5A63 valign=top width=50% height=23>Date:
$date</td>
</tr>
<tr>
<td bgcolor=#4A5A63 valign=top width=50% height=24>Category:
$type</td>
<td bgcolor=#4A5A63 valign=top width=50% height=24>ID:
$id</td>
</tr>
</table></td></tr></table>";
} <====================... here!
mysql_free_result($result);
?>