rich_greeny Posted May 19, 2006 Share Posted May 19, 2006 Hi all, i'm new to php and mysql, but starting to get the hang of it with my comp sci student housemate. I'm trying to return values inserted via a text box, but the top entry in the database won't display. If you add another to the database, then it appears, anyone have any ideas, or code to resolve the issue?CheersRich[blockquote]$sql = "SELECT * FROM $table_name ORDER BY 'date' DESC";$result = mysql_query($sql,$connection) or die("Couldn't execute SELECT query");$row = mysql_fetch_array($result);while ($row = mysql_fetch_array($result)){echo "<tr><td style=\"width: 87px;\" height=\"0\"> </td><td>$row[notice]</td></tr>";}mysql_close();?>[/blockquote] Quote Link to comment https://forums.phpfreaks.com/topic/10016-php-wont-display-newest-value-from-mysql-database/ Share on other sites More sharing options...
kenrbnsn Posted May 19, 2006 Share Posted May 19, 2006 Remove this line:[code]<?php $row = mysql_fetch_array($result); ?>[/code]You are getting the first line, not doing anything with it and then getting all the others. Once you remove that line you will be getting all the lines.Ken Quote Link to comment https://forums.phpfreaks.com/topic/10016-php-wont-display-newest-value-from-mysql-database/#findComment-37207 Share on other sites More sharing options...
rich_greeny Posted May 19, 2006 Author Share Posted May 19, 2006 wooo, thanks a bunch. I've done small amounts of programming, but the whole 'not defining the variables' kind of threw me!Thanks Quote Link to comment https://forums.phpfreaks.com/topic/10016-php-wont-display-newest-value-from-mysql-database/#findComment-37211 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.