Jump to content

MySQL Not Returning the First Row


llcooljayce

Recommended Posts

Hey guys, here's my code:

<html>
  <head>
    <title>Completed RSVPs</title>
  </head>
  <body>
  <center>
  <table border="1">
  <tr>
  <td align="center"><b>Count</b></td>
  <td align="center"><b>First Name</b></td>
  <td align="center"><b>Last Name</b></td>
  <td align="center"><b>Attending Ceremony</b></td>
  <td align="center"><b>Adults</b></td>
  <td align="center"><b>Kids</b></td>
  <td align="center"><b>Attending Reception</b></td>
  <td align="center"><b>Adults</b></td>
  <td align="center"><b>Kids</b></td>
  </tr>

<?

require 'inc/db_connect.php';

$sql = 'select * from verify where complete=1 order by lname, fname';
$result = mysql_query($sql);
$row = mysql_fetch_array($result, MYSQL_BOTH);
$count = 0;

while ($row = mysql_fetch_array($result)) {
$count++;
$fname = $row['fname'];
$lname = $row['lname'];
$ceremony = $row['attending_ceremony'];
$adult_ceremony = $row['adult_ceremony'];
$child_ceremony = $row['child_ceremony'];
$reception = $row['attending_reception'];
$adult_reception = $row['adult_reception'];
$child_reception = $row['child_reception'];

echo '<tr>';
echo '<td align="center">'.$count.'</td>';
echo '<td align="center">'.$fname.'</td>';
echo '<td align="center">'.$lname.'</td>';
if($ceremony=="0")
  echo '<td align="center">No</td>';
else
echo '<td align="center">Yes</td>';
echo '<td align="center">'.$adult_ceremony.'</td>';
echo '<td align="center">'.$child_ceremony.'</td>';
if($reception=="0")
  echo '<td align="center">No</td>';
else
echo '<td align="center">Yes</td>';
echo '<td align="center">'.$adult_reception.'</td>';
echo '<td align="center">'.$child_reception.'</td>';
echo '</tr>';
}
?>
</table>
</center>
</body>
</html>

I don't know why but the 'while ($row = mysql_fetch_array($result)) { ' clause doesn't seem to return the first row of the results ... any ideas why?
Link to comment
https://forums.phpfreaks.com/topic/15271-mysql-not-returning-the-first-row/
Share on other sites

Archived

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

×
×
  • 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.