Jump to content

Recommended Posts

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?

Cheers

Rich

[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]
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
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.