954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Single cell query!

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); <strong><<Error coming here!</strong> :( mysql_num_fields(): supplied argument is not a valid MySQL result resource in
bennetjosem
Newbie Poster
9 posts since Sep 2004
Reputation Points: 10
Solved Threads: 0
 

The error is here

mysql_query($q,$connect);


Try chaging the query to this

$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

$author=$_POST["authorname"];
echo $author;


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

Cheers

darklordsatan
Light Poster
26 posts since Jun 2005
Reputation Points: 10
Solved Threads: 1
 

thnx. I just figured it out! thnx again

bennetjosem
Newbie Poster
9 posts since Sep 2004
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You