Missing Results using mysql_fetch_array
Posted: Wed May 31, 2006 3:39 pm
hello,
I have a table (users) with 4 records, when I do a select * from users and spit it out I only get 3 records. Using phpmyadmin I deleted all the records and recreated them, and still get the same results except it is a different record that is missing. It is the first of the 4 records that is missing.
Here is my code: I am baffaled.
Config.php code:
user info removed for security reasons.
I have a table (users) with 4 records, when I do a select * from users and spit it out I only get 3 records. Using phpmyadmin I deleted all the records and recreated them, and still get the same results except it is a different record that is missing. It is the first of the 4 records that is missing.
Here is my code: I am baffaled.
Code: Select all
<?php include("config.php"); ?>
<?php
mysql_connect($host, $user_name, $password) or die('Could not connect: ' . mysql_error());
mysql_select_db($database_name) or die('Could not select database');
$result = mysql_query("SELECT * FROM users") or die(mysql_error());
$row = mysql_fetch_array( $result );
echo ' <table width=100%><tr><td><strong>Company Address Book</strong> ';
echo ' <table width=90% align=right><tr bgcolor=#eeeeee><td><strong>Name</strong></td><td><strong>Email</strong></td><td><strong>Cell</strong></td></tr> ';
while ($row = mysql_fetch_assoc($result))
{
echo "
<tr>
<td>$row[fname] $row[lname]</td>
<td><a href=mailto:$row[email]>$row[email]</a></td>
<td>$row[cell]</td>
</tr>";
}
echo "</table></td></tr></table>";
?>Config.php code:
Code: Select all
<?php
//config file
ob_start();
session_start();
//mysql info
$host = "#########"; //mysql host
$user_name = "#######"; //mysql username
$password = "########"; //mysql password
$database_name = "########"; //mysql database name
$_login_file = "login.php"; //login page
$redirect_url = "index.php"; //main page;where it is redirected after login
?>