Jump to content

Archived

This topic is now archived and is closed to further replies.

Jeff23

Gathering Mysql info

Recommended Posts

Actually, I\'ve been doing pretty well, but one thing has been bothering me. What is the command to set a variable from a specific row like this:

 

mysql_query("SELECT pid FROM marketb WHERE price=\'$price\'");

$pid = ???

 

How do I set $pid = \'pid\' from the table?

Share this post


Link to post
Share on other sites

$q = mysql_query(\"SELECT pid FROM marketb WHERE price=\'$price\'\");

$r = mysql_fetch_array($q);

$pid = $r[\'pid\'];

 

or you could use mysql_result

Share this post


Link to post
Share on other sites

Hey, thanks a lot for that. It\'s really funny how I figured out the hardest part of that code (the parts I didn\'t post), but just couldn\'t figure out what needed to be done to register the stupid variable! Thanks again!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.