Re: Question about displaying MySQL entries

From: Date: Tue, 27 Jun 2000 00:05:31 +0000
Subject: Re: Question about displaying MySQL entries
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-3248@lists.php.net to get a copy of this message
At 07:01 PM 6/26/00 -0700, Tyler Longren wrote:
Hello, I need to display different mysql entries. Everything that's stored in a seperate row is related to everything else in it's row. Here's my code to display some of the info from the table: <? $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"]; } 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>"; mysql_free_result($result); ?> When I do this though, it only displays the most recent addition to the table. How can I get it to display the information in all of the rows? Not just the most recent row. Can anybody help? Thanks!
Hi Tyler, Place your table inside of your while loop. HTH, Zak Greant Creative Director Nucleus Information Service Inc. "A camel is a horse designed by a committee." - Alex Issigonis (Designer of the Mini)

« previous php.general (#3248) next »