•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 403,515 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,920 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 225 | Replies: 5
![]() |
•
•
Join Date: Jun 2008
Posts: 123
Reputation:
Rep Power: 0
Solved Threads: 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['emailid'];
$firstname = $_POST['fname'] ;
$lastname = $_POST['lname'] ;
$tphone = $_POST['ph1c'].$_POST['ph1a'].$_POST['ph1n'] ;
$message = $_POST['message'];
$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.";
}
?>
<?php
include 'database.php';
$email = $_POST['emailid'];
$firstname = $_POST['fname'] ;
$lastname = $_POST['lname'] ;
$tphone = $_POST['ph1c'].$_POST['ph1a'].$_POST['ph1n'] ;
$message = $_POST['message'];
$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.";
}
?>
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 239
As I can see from your insert query,
the column for email is email_id. But in your select query, you have email
Next time, please use [code] tags to wrap your code.
•
•
•
•
insert into helpdesk(email_id,firstName,lastName,phone,message) values
•
•
•
•
$check = "select * from helpdesk where email='email_id'";
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Apr 2006
Posts: 66
Reputation:
Rep Power: 3
Solved Threads: 11
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
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
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 239
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource (PHP)
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result (PHP)
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in (PHP)
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource (PHP)
Other Threads in the PHP Forum
- Previous Thread: too risky!
- Next Thread: To expire login authentication in our site..



Linear Mode