Jump to content

Archived

This topic is now archived and is closed to further replies.

simcoweb

First row of data is not showing up

Recommended Posts

On this page: [url=http://www.highlandbluffsresort.com/phase-two.php]http://www.highlandbluffsresort.com/phase-two.php[/url] the first item in the list of lots should be Lot #2. Instead it's showing Lot#3 as the first item. When I view the database in PHPMyAdmin it clearly shows lot #2 as the first row. I can't understand why it doesn't show in the posted results in the page. Here's the code:

[code]$sql=("SELECT * FROM phase_two");
$results=mysql_query($sql);
$row = mysql_fetch_row($results);
$num_rows = mysql_num_rows($results);
if ($num_rows == 0) {
echo "<font class='bodytext'><center>We are sorry. The lot information is unavailable at this time.<br /> Please contact us for details on available lots.<br />";
} else {

echo "
<table width='700' border='0' align='center' onMouseover=\"changeto(event, 'darkkhaki')\" onMouseout=\"changeback(event, 'lightgoldenrodyellow')\">
<tr>
<th><font face=\"Verdana\" size=\"2\">Lot #</th>
<th><font face=\"Verdana\" size=\"2\">Sq. Ft.</th>
<th><font face=\"Verdana\" size=\"2\">Street</th>
<th><font face=\"Verdana\" size=\"2\">Frontage</th>
<th><font face=\"Verdana\" size=\"2\">Location</th>
<th><font face=\"Verdana\" size=\"2\">View</th>
<th><font face=\"Verdana\" size=\"2\">Acres</th>
<th><font face=\"Verdana\" size=\"2\">Price</font></th>
<th><font face=\"Verdana\" size=\"2\">&nbsp;</th>
</tr>";
while ($a_row = mysql_fetch_array( $results )) {
echo "
<tr bgcolor=\"lightgoldenrodyellow\">
<td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">" . $a_row['lot'] . "</td>
<td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">" . $a_row['sq_feet'] . "</td>
<td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">" . $a_row['street'] . "</td>
<td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">" . $a_row['frontage'] . "</td>
<td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">" . $a_row['location'] . "</td>
<td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">" . $a_row['view'] . "</td>
<td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">" . $a_row['acres'] . "</td>
<td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">\$" . $a_row['sale_price'] . "</td>
<td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\"><a href=\"contact-p2.php?id=" . $a_row['lot'] . "\">Contact</a></td>
</tr>";
}

print "</table>\n";
echo "<br>";
}
//print "</table>\n";[/code]


I can't see anything here that would tell it to ignore row 1 of the table. Ideas?

Share this post


Link to post
Share on other sites
$sql=("SELECT * FROM phase_two");
$results=mysql_query($sql);
[color=red]$row = mysql_fetch_row($results);[/color]

That line reads first row and throws it away

Share this post


Link to post
Share on other sites
Thanks, Barand. That speck of code wasn't even necessary since the $row variable wasn't being used. I commented it out and the script is now producing the display of all the data rows.

Share this post


Link to post
Share on other sites

×

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.