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!

Recommended Answers

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

Jump to Post

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());
Jump to Post

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]; …
Jump to Post

All 9 Replies

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

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

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)
{
 
}

?>

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

place echo for $rs and see what you getting

place echo where?:)

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

Member Avatar

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());

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];
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.