0

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.";
}


?>

Edited by happygeek: fixed formatting

5
Contributors
5
Replies
6
Views
9 Years
Discussion Span
Last Post by Shanti C
0

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.

0

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

0

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.

0

hi...

I think if you correct this query as

$email=$_POST;

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

you will get the result

0

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

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.