MySQL Forums
Forum List  »  PHP

Re: how to use PHP variable in MYSQL query?
Posted by: floid smith
Date: May 28, 2008 12:01PM

I tried a lot of different things. This seems to work for me.
The $adquote adds a quotes around the variable.



$var = $_GET['id'];
$adquote = "'$var'";


$query = 'SELECT * FROM table WHERE col =' .$adquote.'';

Options: ReplyQuote


Subject
Written By
Posted
Re: how to use PHP variable in MYSQL query?
May 28, 2008 12:01PM


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.