SELECT using variable fails

admin

Administrator
Staff member
Similar to a question KKing had earlier.

I have a user make a selection in a WML (PHP generated) card. That variable is called $response.

Now, in the following code I *do* get the first print option to print the value of the $response variable :>

print "The chosen ID = $(response)<br/>";

However I have been unsuccessful when trying to utilize that variable in a SELECT statement. The select works great when I use a literal, as in the case of searching for 'Dave' here :>

$result=@mysql_query("select first, last, tie, photo from employees where first = 'Dave'");

So but whenever I try ... where first = $response

or ...where first = $(response)

I get errors from the WML simulator as follows :>

Warning: Supplied argument is not a valid MySQL result resource in c:
\program files\apache\htdocs\emp.php on line 49

Anyone know what's up?

Stuart
 
Back
Top