Query is double posting results?
I thought I had some problem with my PHP code at first, but then I took my code down to the bare essentials and I'm still getting this weird result.
When I run this simple query it prints out each field from the table twice and then moves on to the next field.
(i.e. userId, userId, userName, userName, userInfo, userInfo, etc, etc...)
Here's the code:
<?php
if (!($connection = mysql_connect("localhost", "root", "may1968")))
die ("Cannot Connect to DB!");
if (!(mysql_select_db("mhs", $connection)))
showerror();
function showerror() {
die ("Error " . mysql_errno() . " : " . mysql_error());
$result = mysql_query ("SELECT * FROM users WHERE userId = 1");
while ($row = mysql_fetch_array ($result))
{
foreach ($row as $stuff)
print "{$stuff} ";
print "\n";
}
?>
I've checked and double checked the DB with the MySQL Command Line Client and the table looks fine to me... no doubles there. Any ideas?
|