Jump to content

[SOLVED] Can't figure this out : Warning: mysql_num_rows(): supplied argument is not a va


~n[EO]n~

Recommended Posts

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

on line 54

code is like this

 

<?php $sSql="Select mem_password from ".MEMBER_TABLE." where mem_email = ".$_REQUEST['mem_email'];
		//echo $sSql;
		$result=mysql_query($sSql);	
		if(mysql_num_rows($result)!=0)
		{
		$array=mysql_fetch_array($result);
		$yourpassword = $array['mem_password'];
		echo $yourpassword;
		$formail_pwd = TRUE;
		}
		else
		{
			$app->error_display_type=2;
		 	$app->error("E-mail id could not be found.");
		 	$formail_pwd = TRUE;
		} ?>

 

line 54 is this

if(mysql_num_rows($result)!=0)

 

thanks

Your problem is in your SQL statement

most likely it's because you don't have quotes around your REQUEST variable

but just in case

 

change this

$result=mysql_query($sSql);

 

to this

$result=mysql_query($sSql) or die("Your have an error because:
" . mysql_error());

 

and come back with the results

Got this

 

Your have an error because:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@hotmail.com' at line 1

 

I want to fetch the password from the db, i entered [email protected] in form field, why is it showing error near @

hi,

 

Change your select statement to this code. It seems that there is a mistake in your current select statement.

 

$sSql="Select mem_password from '.MEMBER_TABLE.' where mem_email = \"$_REQUEST['mem_email']\";";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.