I seriously have no clue why this isn't working. What I am trying to do is simply get all the emails in my database and then echo them, but no matter what I try mysql_fetch_array is not working. It isn't the SQL query that isn't working, because I have added a if statement that dies if it isn't working, not only that, but I have gone on PHPMyAdmin, and done the exact same query, and it works.
This is my code
<?php
$dbc = mysql_connect('localhost', 'root', ''); //host, username, pass
$db = mysql_select_db('habbo', $dbc);
if(!$dbc || !$db)
die("Unknown Error.");
$sql = "SELECT `email` FROM `logininfo` WHERE `id` = '1'";
mysql_query($sql);
if(!$sql)
die(mysql_error());
while($row = mysql_fetch_array($sql))
echo $row['email'] . " ";
?>
So, I have no idea what is going on, both of my error traps don't come up, I just get an error when I go to the page saying this
Warning: mysql_fetch_array() expects parameter 1 to be resource, string given on line 14
I assume that it means that the query is broken, but the query isn't, because like I said earlier, I have set up error traps, and tried the query in PHPMyAdmin, so it might be something wrong with XAMPP, or something. I have restarted Apache, and MySQL, but still I get the same error.