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,

<?php
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;
$User="";
$check  = "select * from helpdesk where email='email_id'";
if(!$check)
{
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
{


mysql_close();
$User = " Email id already exist.";
}


?>

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.

hi...

I think if you correct this query as

$email=$_POST;

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

you will get the result

Helloo..

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

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.