User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 402,933 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,034 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 MySQL advertiser: Programming Forums
Views: 1983 | Replies: 2 | Solved
Reply
Join Date: Sep 2004
Posts: 9
Reputation: bennetjosem is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
bennetjosem bennetjosem is offline Offline
Newbie Poster

Single cell query!

  #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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2005
Location: Planet Earth
Posts: 26
Reputation: darklordsatan is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
darklordsatan's Avatar
darklordsatan darklordsatan is offline Offline
Light Poster

Re: Single cell query!

  #2  
Jun 30th, 2005
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
Reply With Quote  
Join Date: Sep 2004
Posts: 9
Reputation: bennetjosem is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
bennetjosem bennetjosem is offline Offline
Newbie Poster

Re: Single cell query!

  #3  
Jul 1st, 2005
thnx. I just figured it out! thnx again
Reply With Quote  
Reply

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

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

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

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