jedenerio Posted December 13, 2012 Share Posted December 13, 2012 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/asensoco/public_html/config.php on line 4 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/asensoco/public_html/config.php on line 4 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/asensoco/public_html/index.php on line 14 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/asensoco/public_html/config.php on line 4 How can i fix this? Quote Link to comment https://forums.phpfreaks.com/topic/271939-i-am-getting-these-mysql-warnings-on-a-website-i-am-trying-to-upload-thru-a-php-template/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 13, 2012 Share Posted December 13, 2012 By finding out why the parameter you are passing into the mysql_num_rows function is a boolean instead of a resource. A SELECT query that runs without any errors will return a result resource. The error you are getting is typical of a SELECT query that failed due to an error and you don't have any error checking logic in your code to test if the query worked before using the result in following statements. You can echo mysql_error() after the point where you execute your query to find out why the query is failing. Quote Link to comment https://forums.phpfreaks.com/topic/271939-i-am-getting-these-mysql-warnings-on-a-website-i-am-trying-to-upload-thru-a-php-template/#findComment-1399087 Share on other sites More sharing options...
jedenerio Posted December 13, 2012 Author Share Posted December 13, 2012 This is what it looks like in my CONFIG.PHP file, i can't tell here which one is the error <?php include "dbconfig.php"; $rs=mysql_query("select * from adminsettings"); if(mysql_num_rows($rs)>0) { $arr=mysql_fetch_array($rs); $sitename=$arr[0]; $siteurl=$arr[1]; $webmasteremail=$arr[2]; $adminuser=$arr[46]; $adminpass=$arr[3]; $alertpay=$arr[4]; $fee=$arr[7]; $levels=$arr[8]; $level1=$arr[9]; $level2=$arr[10]; $level3=$arr[11]; $level4=$arr[12]; $level5=$arr[13]; $level6=$arr[14]; $level7=$arr[15]; $level8=$arr[16]; $level9=$arr[17]; $level10=$arr[18]; $forcedmatrix=$arr[19]; $membershipperiod=$arr[20]; $duration=$membershipperiod; $signupbonus=$arr[21]; $bonusduration=$arr[47]; $pendingnotification=$arr[48]; $ipncode=$arr[52]; $yfwid=$arr[22]; $subject1=$arr[23]; $message1=$arr[24]; $subject2=$arr[25]; $message2=$arr[26]; $subject3=$arr[27]; $message3=$arr[28]; $subject4=$arr[29]; $message4=$arr[30]; $subject5=$arr[49]; $message5=$arr[50]; $eformat1=$arr[31]; $eformat2=$arr[32]; $eformat3=$arr[33]; $eformat4=$arr[34]; $eformat5=$arr[51]; $subject6=$arr[53]; $message6=$arr[54]; $eformat6=$arr[55]; $subject7=$arr[56]; $message7=$arr[57]; $eformat7=$arr[58]; $subject8=$arr[59]; $message8=$arr[60]; $eformat8=$arr[61]; $subject9=$arr[62]; $message9=$arr[63]; $eformat9=$arr[64]; $extramerchants=$arr[35]; $merchantname1=stripslashes($arr[36]); $merchantcode1=stripslashes($arr[37]); $merchantname2=stripslashes($arr[38]); $merchantcode2=stripslashes($arr[39]); $merchantname3=stripslashes($arr[40]); $merchantcode3=stripslashes($arr[41]); $merchantname4=stripslashes($arr[42]); $merchantcode4=stripslashes($arr[43]); $merchantname5=stripslashes($arr[44]); $merchantcode5=stripslashes($arr[45]); $rs=mysql_query("select * from adminsettingsm"); if(mysql_num_rows($rs)>0) { $arr=mysql_fetch_array($rs); $mlevel1=$arr[0]; $mlevel2=$arr[1]; $mlevel3=$arr[2]; $mlevel4=$arr[3]; $mlevel5=$arr[4]; $mlevel6=$arr[5]; $mlevel7=$arr[6]; $mlevel8=$arr[7]; $mlevel9=$arr[8]; $mlevel10=$arr[9]; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/271939-i-am-getting-these-mysql-warnings-on-a-website-i-am-trying-to-upload-thru-a-php-template/#findComment-1399088 Share on other sites More sharing options...
PFMaBiSmAd Posted December 13, 2012 Share Posted December 13, 2012 i can't tell here which one is the error The ones matching the file and line numbers listed in the error messages. Quote Link to comment https://forums.phpfreaks.com/topic/271939-i-am-getting-these-mysql-warnings-on-a-website-i-am-trying-to-upload-thru-a-php-template/#findComment-1399091 Share on other sites More sharing options...
jedenerio Posted December 13, 2012 Author Share Posted December 13, 2012 I don't know anything about PHP. Quote Link to comment https://forums.phpfreaks.com/topic/271939-i-am-getting-these-mysql-warnings-on-a-website-i-am-trying-to-upload-thru-a-php-template/#findComment-1399092 Share on other sites More sharing options...
PFMaBiSmAd Posted December 13, 2012 Share Posted December 13, 2012 The only thing in this thread that requires any specific php knowledge would be the actual syntax for the echo statement - echo mysql_error(); Quote Link to comment https://forums.phpfreaks.com/topic/271939-i-am-getting-these-mysql-warnings-on-a-website-i-am-trying-to-upload-thru-a-php-template/#findComment-1399094 Share on other sites More sharing options...
jedenerio Posted December 13, 2012 Author Share Posted December 13, 2012 if yu go to www.asenso500.com you will see the warnings in there. im really struggling making the site work i hope i can someone help me with those 2 remaining warnings. Quote Link to comment https://forums.phpfreaks.com/topic/271939-i-am-getting-these-mysql-warnings-on-a-website-i-am-trying-to-upload-thru-a-php-template/#findComment-1399095 Share on other sites More sharing options...
Christian F. Posted December 13, 2012 Share Posted December 13, 2012 If you haven't read this thread already, then I'd recommend doing so. It'll help you in debugging the MySQL errors, so that you can get them sorted out. Quote Link to comment https://forums.phpfreaks.com/topic/271939-i-am-getting-these-mysql-warnings-on-a-website-i-am-trying-to-upload-thru-a-php-template/#findComment-1399115 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.