Jump to content

I Am Getting These Mysql Warnings On A Website I Am Trying To Upload Thru A Php Template


Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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];

}

}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.