Im trying to do a mysql query but for some reason this is the error I'm getting:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home1/server/public/chat/includes/functions/chat.func.php on line 9
Line 9 is as follows:
l6 $query = "SELECT `Sender`, `Message` FROM `database_chat`.`chat` ORDER BY `Msg_ID` DESC";
l7 $run = mysql_query($query);
l8 $messages = array();
l9 while($message = mysql_fetch_assoc($run)) {...
database's name is 'database_chat' and 'chat' is the table...
For some reason it ain't connecting, what am I missing?
I've double-checked that the table elements are correctly written....
$run = mysql_query($query) or die(mysql_error());mysql_*functions anymore, they are deprecated. See Why shouldn't I use mysql_* functions in PHP? for details. Instead you should learn about prepared statements and use either PDO or MySQLi. If you can't decide which, this article will help you. If you pick PDO, here is a good tutorial.