0

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); [B]<<Error coming here![/B] :( mysql_num_fields(): supplied argument is not a valid MySQL result resource in
2
Contributors
2
Replies
3
Views
12 Years
Discussion Span
Last Post by bennetjosem
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

This question has already been answered. 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.