Bizarre MySQL & PHP problem

wxdqz

New Member
Here's the problem. This code works perfectly on a different table. It doesn't generate any errors on the page in question. The problem, however, is that on this particular page, pulling from this particular table, it only returns every other row from the database. The query works find directly in mysql, and the code works on other pages/tables. Any ideas?

<?

$connection = mysql_connect("server", "user", "password") or die ("Couldn't connect to database");
$db = mysql_select_db("database", $connection) or die ("Couldn't select DB");
$sql = "SELECT tablekeyID,lastname,firstname,title,email,phone FROM table ORDER BY level;";
$sql_result = mysql_query($sql, $connection) or die ("Couldn't execute query");

while ($row = mysql_fetch_array($sql_result)){

$field = mysql_fetch_array( $sql_result );
echo '<tr>';
echo '<td><a href=http://www.phpbuilder.com/board/archive/index.php/"staffdetail.php?codet='.$field[" tablekeyID"].'">'.$field["firstname"].' '.$field["lastname"].'</a></td>';
echo '<td>'.$field["title"].'</td>';
echo '<td>'.$field["phone"].'</td>';
echo '<td><a href=http://www.phpbuilder.com/board/archive/index.php/"mailto:'.$field["email"].'">'.$field["email"].'</a></td>';
echo "</tr>\n";
}
?>
 
Back
Top