ballhogjoni Posted February 19, 2007 Share Posted February 19, 2007 Why do I get these errors: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/realfina/public_html/tests/cvlsofttest/testexcel.php on line 13 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/realfina/public_html/tests/cvlsofttest/testexcel.php on line 18 this is my code: <?php $username="xxxxx"; $password="xxxxx"; $database="xxxxx"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $sql = mysql_query("SELECT * FROM contactinfo"); $result=mysql_query($sql); $result1 = mysql_fetch_array($result); $sql1 = mysql_query("SELECT * FROM question2checkbox"); $result2=mysql_query($sql1); $result3 = mysql_fetch_array($result2); mysql_close(); ?> Link to comment https://forums.phpfreaks.com/topic/39231-warning-mysql_fetch_array-supplied-argument/ Share on other sites More sharing options...
papaface Posted February 19, 2007 Share Posted February 19, 2007 Should be: <?php $username="xxxxx"; $password="xxxxx"; $database="xxxxx"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $sql = mysql_query("SELECT * FROM contactinfo"); $result= mysql_fetch_array($sql); $sql1 = mysql_query("SELECT * FROM question2checkbox"); $result2 =mysql_fetch_array ($sql1); mysql_close(); ?> Link to comment https://forums.phpfreaks.com/topic/39231-warning-mysql_fetch_array-supplied-argument/#findComment-189022 Share on other sites More sharing options...
metrostars Posted February 19, 2007 Share Posted February 19, 2007 I only hda time for a quick check, but try this. <?php $username="xxxxx"; $password="xxxxx"; $database="xxxxx"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $sql = mysql_query("SELECT * FROM contactinfo"); $result1 = mysql_fetch_array($sql); $sql1 = mysql_query("SELECT * FROM question2checkbox"); $result2 = mysql_fetch_array($sql1); mysql_close(); ?> EDIT- AAh Beat me to it. Link to comment https://forums.phpfreaks.com/topic/39231-warning-mysql_fetch_array-supplied-argument/#findComment-189025 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.