Hi all, i am getting Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\xampp\htdocs\demo\help.php on line 23 this error. how to overcome by this problem,

include 'database.php';

$email = $_POST;
$firstname = $_POST ;
$lastname = $_POST ;
$tphone = $_POST.$_POST.$_POST ;
$message = $_POST;
$querys = "insert into helpdesk(email_id,firstName,lastName,phone,message) values ('".$email."','".$firstname."','".$lastname."','".$tphone."','".$message."')";
$result = mysql_query($querys);
echo $result;
echo $querys;
$check  = "select * from helpdesk where email='email_id'";
die('Could not connect: ' . mysql_error());
$rcheck = mysql_query($check) ;

$num    = mysql_num_rows($rcheck);

$rcheck = mysql_fetch_array($rcheck);

if($num == 0)  // if user not found
$result = mysql_query($querys);
$User = " successfull.";
}   else

$User = " Email id already exist.";


Edited 3 Years Ago by happygeek: fixed formatting

As I can see from your insert query,

insert into helpdesk(email_id,firstName,lastName,phone,message) values

the column for email is email_id. But in your select query, you have email

$check = "select * from helpdesk where email='email_id'";

Next time, please use [code] tags to wrap your code.

the easiest way to see what or where you have errors is to use as much as you can mysql_error() command.
if you want to see if your select command is wrong, you can use something like this:

$rcheck = mysql_query($check) or die(mysql_error()); ....

best regards

Yes I do have one. Please pm to get the bulk coupon.
Anybody interested in buying itechbids v7.0 @ 10% discount? Please use
my reseller coupon: RES3215.

Stop advertising.


I think if you correct this query as


$check = "select * from helpdesk where email='$email'";

you will get the result


Put echo to your insert query and then copy and paste the output query into your databse,then you will find where will be your error placed..
I think its very small to recover..
Hope got..

This article has been dead for over six months. Start a new discussion instead.