0

Hi,
yesterday i downloaded a script.
Now, im installing it on my website, but when i load index.php page and all the page where config.php is included, it say that:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mhd-01/www.newsict.com/htdocs/config.php on line 13

this is config.php :

<?php
// Provide Values for Database
$dbhost="host";
$dbname="name";
$dbuser="user";
$dbpass="password";

//Don't change the below 2 lines
  $dbconnect=mysql_connect($dbhost,$dbuser,$dbpass);
  mysql_select_db($dbname);

$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];
$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];
$signupbonus=$arr[21];
}
?>

Thanks for you help,guys.

doS!

5
Contributors
9
Replies
12
Views
7 Years
Discussion Span
Last Post by it200219
0

Hi

There is an error in your line 12

$rs=mysql_query("select * from adminsettings");

need to supply connection also to execute the query.
Like this:

$rs=mysql_query("select * from adminsettings", $dbconnect);
0

Hi,
i tried your solution, but it still say the same thing.
Do you have any other idea?

0

Hi

Try Like This

<?php

$link = mysql_connect("localhost", "mysql_user", "mysql_password");
mysql_select_db("database", $link);

$result = mysql_query("SELECT * FROM table1", $link);
$num_rows = mysql_num_rows($result);

echo "$num_rows Rows\n";

if($num_rows>0)
{
 
}

?>
0

Tried that, but the error is the same, just in a different line :O

0

one thing is for sure, theres an error in connecting to the database or selecting a table or wrong table names you have renamed it, review your database

0

Use like below to identify if you have any errors in your Query. or execute your query in your phpadmin sql editor.

$query = "select * from table";
$result = mysql_query($query) or die(mysql_error());
0

Try this,

<?php
// Provide Values for Database
$dbhost="host";
$dbname="name";
$dbuser="user";
$dbpass="password";

//Don't change the below 2 lines
  $dbconnect=mysql_connect($dbhost,$dbuser,$dbpass) or die(mysql_error());
  mysql_select_db($dbname) or die(mysql_error());

$rs=mysql_query("select * from adminsettings")  or die(mysql_error());
if(mysql_num_rows($rs)>0) {
$arr=mysql_fetch_array($rs);
$sitename=$arr[0];
$siteurl=$arr[1];
$webmasteremail=$arr[2];
$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];
$signupbonus=$arr[21];
}
?>

Edited by it200219: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.