Hi all,

This is an error im recieving on server, BUT, no error on local

hostWarning: mysql_fetch_array(): supplied argument is not a valid MySQL result line 49

This is the code it is referring to....

<?php
 
$sql_query = "SELECT * FROM `indexinfo` WHERE id = '1'"; 

//store the queried cell in the variable 
//named $result 
$result = mysql_query($sql_query);  

//display the queried cell                                              

echo $row = mysql_fetch_array($result);                    // line 49
?>

Hi there,
The error that you are getting indicates that your query is either invalid or the result set that it returns is empty. Just double check that your SQL statement run correctly on your phpMyAdmin or other SQL command panel, and that there is data in the database.

Additionally,

echo $row = mysql_fetch_array($result);

Will always print "array()", since $row is always an array object.
Use the following instead:

$row = mysql_fetch_array($result);
echo "<pre>";
print_r($row);
echo "</pre>";

Hi,

thanks for the answer and the info. I found the issue. Im busy transferring data from local to hosted and i needed to change the localhost reference to the ip address, and amend the database name variable.

thanks again for your help

This question has already been answered. Start a new discussion instead.