Single cell query!

Thread Solved

Join Date: Sep 2004
Posts: 9
Reputation: bennetjosem is an unknown quantity at this point 
Solved Threads: 0
bennetjosem bennetjosem is offline Offline
Newbie Poster

Single cell query!

 
0
  #1
Jun 30th, 2005
How can i display result of a single cell query?
my query is
$author=$_POST["authorname"];
$q="Select authorid from authors where AuthorName=$author";
$resultauthor=mysql_query($q,$connect);
$num=mysql_num_fields($resultauthor); <<Error coming here! :( mysql_num_fields(): supplied argument is not a valid MySQL result resource in
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 26
Reputation: darklordsatan is an unknown quantity at this point 
Solved Threads: 1
darklordsatan's Avatar
darklordsatan darklordsatan is offline Offline
Light Poster

Re: Single cell query!

 
0
  #2
Jun 30th, 2005
The error is here
  1. mysql_query($q,$connect);

Try chaging the query to this
  1. $q="Select authorid from authors where AuthorName='$author'";
Probably its because of the missing '' or simply, you´re not getting the POST variable authorname

Try this
  1. $author=$_POST["authorname"];
  2. echo $author;

Do you get what you expect?
If nothing of this works, then you have a problem in $connect

Cheers
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 9
Reputation: bennetjosem is an unknown quantity at this point 
Solved Threads: 0
bennetjosem bennetjosem is offline Offline
Newbie Poster

Re: Single cell query!

 
0
  #3
Jul 1st, 2005
thnx. I just figured it out! thnx again
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC