Jump to content


Photo

Gathering Mysql info


  • Please log in to reply
2 replies to this topic

#1 Jeff23

Jeff23
  • Members
  • Pip
  • Newbie
  • 8 posts

Posted 08 June 2003 - 03:47 PM

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?

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 09 June 2003 - 02:52 AM

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

or you could use mysql_result
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#3 Jeff23

Jeff23
  • Members
  • Pip
  • Newbie
  • 8 posts

Posted 09 June 2003 - 08:10 PM

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!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users