mattyd Posted October 19, 2010 Share Posted October 19, 2010 I have searched for this topic here but have not found reference to it. I am receiving the following: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a4542527/public_html/index.php on line 8 The scripting for this is basic at this point (I am building something in steps and this is just a test section: The script will call data from the table and display said data.) The following is the code (two, separate files located on my server)- I am hoping that someone may see something that I am missing. connection.php <?php $dbhost = 'mysql7.000webhost.com'; $dbuser = 'a4542527_root'; $dbpass = '**********'; $db = 'a4542527_test1'; $conn = mysql_connect($dbhost,$dbuser,$dbpass); mysql_select_db($db); ?> index.php <?php include 'connection.php'; $query = "SELECT * FROM people"; $result = "mysql_query($query)"; while ($person = mysql_fetch_array($result)){ echo $person ['name']; echo $person ['descrip']; } ?> Thank-you for any help, suggestions or a point in the right direction. ~Matty Quote Link to comment https://forums.phpfreaks.com/topic/216208-mysql_fetch_array-supplied-argument-is-not-a-valid/ Share on other sites More sharing options...
BlueSkyIS Posted October 19, 2010 Share Posted October 19, 2010 $result = mysql_query($query) or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/216208-mysql_fetch_array-supplied-argument-is-not-a-valid/#findComment-1123646 Share on other sites More sharing options...
hitman6003 Posted October 19, 2010 Share Posted October 19, 2010 $result = "mysql_query($query)"; ...should not be in quotes. Quote Link to comment https://forums.phpfreaks.com/topic/216208-mysql_fetch_array-supplied-argument-is-not-a-valid/#findComment-1123649 Share on other sites More sharing options...
mattyd Posted October 19, 2010 Author Share Posted October 19, 2010 Quote $result = mysql_query($query) or die(mysql_error()); Thank-you so much for your help! That worked perfectly. I really appreciate your help. ~Matty Quote Link to comment https://forums.phpfreaks.com/topic/216208-mysql_fetch_array-supplied-argument-is-not-a-valid/#findComment-1123651 Share on other sites More sharing options...
mattyd Posted October 19, 2010 Author Share Posted October 19, 2010 Quote $result = "mysql_query($query)"; ...should not be in quotes. Thank-you for your reply and help. Quote Link to comment https://forums.phpfreaks.com/topic/216208-mysql_fetch_array-supplied-argument-is-not-a-valid/#findComment-1123653 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.