MySQL Forums
Forum List  »  PHP

Re: how to use PHP variable in MYSQL query?
Posted by: P. Boomer
Date: November 13, 2008 02:52PM

Hmmm. I can get this to work:


$query = ('SELECT * FROM `demo` WHERE `IDENTIFIER` = "411903"');

The field IDENTIFIER is not really a number, it's treated as a string. Works fine.

But, if I want to get the value of the field from, say, a variable called $pick that gets it from a user's choice in a dropdown list,i.e.

$pick = "411903";
$query = ('SELECT * FROM `demo` WHERE `IDENTIFIER` = "$pick"');

Doesn't work.

How do you represent a variable in the SELECT statement?

Options: ReplyQuote


Subject
Written By
Posted
Re: how to use PHP variable in MYSQL query?
November 13, 2008 02:52PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.