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

Recommended Answers

All 2 Replies

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

thnx. I just figured it out! thnx again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.