User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Jun 2008
Posts: 123
Reputation: ishlux is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ishlux ishlux is offline Offline
Junior Poster

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

  #1  
Jul 2nd, 2008
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.";
}

?>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 239
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

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

  #2  
Jul 2nd, 2008
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.
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*
Reply With Quote  
Join Date: Apr 2006
Posts: 66
Reputation: silviuks is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 11
silviuks silviuks is offline Offline
Junior Poster in Training

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

  #3  
Jul 2nd, 2008
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
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 239
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

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

  #4  
Jul 3rd, 2008
Originally Posted by swatisinha.339 View Post
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.
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*
Reply With Quote  
Join Date: Sep 2007
Posts: 20
Reputation: ditty is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
ditty ditty is offline Offline
Newbie Poster

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

  #5  
Jul 3rd, 2008
hi...

I think if you correct this query as

$email=$_POST['emailid'];

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

you will get the result
Reply With Quote  
Join Date: Jul 2008
Location: Hyderabad,India.
Posts: 539
Reputation: Shanti Chepuru is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 53
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Posting Pro

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

  #6  
Jul 3rd, 2008
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..
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 1:01 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC