0

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..

Edited by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

2
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by rustifer
0

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.

0

Hi
it comes back with No database selected.

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

0

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..

Edited by rustifer: n/a

0

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.

0

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

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.