mysql_select_db('fireworks', $conn);
$ask = "SELECT * FROM name";
$result = mysql_query($ask, $conn) or die();
while ($info = mysql_fetch_assoc($result));
{
var_dump($info);
if (is_array($result)) {
foreach ($info as $group) {
print $group;
} //end foreach
} else {
print "fail..";
}//end debug
} //end while
I checked with phpmyadmin and the database fireworks CLEARLY has a table named ‘name’ in it. When I use var_dump it shows bool(false). I heard that mysql_fetch_assoc is suppose to return false only if there is no more values left to print?
Edit: Sorry I should have included the full code:
$conn = mysql_connect("localhost", "root") or die(mysql_error());
if ($conn)
{
print "<h1>CONNECTED!!!!</h1>";
}//end conn
Yes, I have information listed in the table, I checked the name of everything:
ID firstName lastName
1 uraz The pig
2 Billy Henson
3 Jean Jerk
4 Fat Jerk
Your code has a logical syntax error:
Currently this causes it to loop through all the rows, and when it’s done you’re left with the last value (false).
You should have: