Hi there

Im getting this error message with a script im trying to use.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/rideron1/public_html/join_form.php on line 67
No database selected

The script im using works on my local server but as soon as I upload it to my web server it gives the above error, the section of code that is giving me the problem is

// Connect to database
     include "script/db_connect_online.php";
     $emailCHecker = mysql_real_escape_string($email1);
	 $emailCHecker = eregi_replace("`", "", $emailCHecker);
     // Database duplicate e-mail check setup for use below in the error handling if else conditionals
     $sql_email_check = mysql_query("SELECT email FROM mymembers WHERE email='$emailCHecker'");
     $email_check = mysql_num_rows($sql_email_check);

please help its driving me nuts..

Hi and welcome to daniweb. Could you please edit your post and add code tags. Also as for the solution change the second last line to the following:

$sql_email_check = mysql_query("SELECT email FROM mymembers WHERE email='$emailCHecker'") or die(mysql_error());

Then tell me what error that reports.

Hi
it comes back with No database selected.

how do I go back into my thread to edit it?

Hi there

Im getting this error message with a script im trying to use.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/rideron1/public_html/join_form.php on line 67
No database selected

The script im using works on my local server but as soon as I upload it to my web server it gives the above error, the section of code that is giving me the problem is

// Connect to database
include "script/db_connect_online.php";
$emailCHecker = mysql_real_escape_string($email1);
$emailCHecker = eregi_replace("`", "", $emailCHecker);
// Database duplicate e-mail check setup for use below in the error handling if else conditionals
$sql_email_check = mysql_query("SELECT email FROM mymembers WHERE email='$emailCHecker'");
$email_check = mysql_num_rows($sql_email_check);

please help its driving me nuts..

it comes back with No database selected.

It means you haven't used the mysql_select_db() function. I would suggest reading up on a mysql tutorial.

Thanks for the help, I have modified the mysql connection script and added the mysql_select_db() function and it works perfect now.

thanks again for the help

Be a part of the DaniWeb community

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