I am having a similar problem with a while loop.....I am trying to have a table where the rows alternate colors, so it becomes easier to read. here is my code: [code] // Make the query. $query = "SELECT last_name, first_name, DATE_FORMAT (registration_date, '%M %d, %Y') AS dr, user_id FROM users ORDER BY $order_by LIMIT $start, $display"; $result = mysql_query ($query); // Run the query. ... // Fetch and print all the records. $bg = '#eeeeee'; // Set the background color. while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $bg = ($bg=='#eeeeee' ? '#ffffff' : '#eeeeee'); // Switch the background color. echo '<tr bgcolor="' . $bg . '"> <td align="left"><a href="edit_user.php?id=' . $row['user_id'] . '">Edit</a></td> <td align="left"><a href="delete_user.php?id=' . $row['user_id'] . '">Delete</a></td> <td align="left">' . $row['last_name'] . '</td> <td align="left">' . $row['first_name'] . '</td> <td align="left">' . $row['dr'] . '</td> </tr> '; }[/code] here is the error(warning) I keep getting: [code]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Apache2\htdocs\view_users.php on line 107[/code] Does anyone have any ideas as to why result becomes invalid?