Author Topic: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resourc  (Read 134 times)

0 Members and 1 Guest are viewing this topic.

Offline jigsawsoulTopic starter

  • Enthusiast
  • Posts: 133
    • View Profile
Code: [Select]
I'm getting this error message and im not sure why
[codeWarning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/jigsaws2/public_html/project/public/_login/reg2.php on line 14

<?php

session_start
();
ob_start();

include(
'../../resources/config.php');
include(
$config["paths"]["resources"] . 'opendb.php');
include(
$config["paths"]["resources"] . '_library/login.php');

	
$email mysql_real_escape_string($_POST['email']);
	
$password mysql_real_escape_string($_POST['password']);
	

	
$result mysql_query("SELECT email FROM productlogin WHERE email = '$email'");
	
$emailcheck mysql_num_rows($result);
	

	
if(
$emailcheck 0){
	
	
$_SESSION["message"] = 
	
	
   
'This email address is already registered with us. 
	
	
	
Having trouble, you can <a href="recover.php">reset your password here</a>.'
;
	
	
header ('Location: register.php');
	
	
exit();
	
}
	

include(
$config["paths"]["resources"] . 'closedb.php');

?>

Offline PFMaBiSmAd

  • Guru
  • 'Insane!'
  • *
  • Posts: 14,588
  • In Coding, Automatic means you write code to do it
    • View Profile
Your query failed to execute and returned a FALSE value instead of a result resource.

Echo mysql_error() to find out why the query failed.
Signature: (not a comment about anything you posted unless specifically indicated)
Debugging step #1: To get past the garbage-out equals garbage-in stage in your code, you must check that the inputs to your code are what you expect.

Programming is just problem solving, but it is done in another language. You must learn enough of the programming language you are using to be able to read and write code.