Jump to content

Archived

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

thisagain

Need help placing variable in query

Recommended Posts

This query string works:


$query = 'SELECT * FROM `models` WHERE `fname` = CONVERT(_utf8 \'[color=red]Trains[/color]\' USING latin1) COLLATE latin1_swedish_ci';



...but I want to make [color=red]Trains[/color] a variable called $fname; however when I  try and change Trains to $fname, the query show up empty

if it helps, the variable $fname is passed onto the page by $fname=$_GET['name'];


If anyone can help me with this, it would be greatly appreciated.  Thanks

Share this post


Link to post
Share on other sites
Use double quotes:
$query = "SELECT * FROM `models` WHERE `fname` = CONVERT(_utf8 '$fname' USING latin1) COLLATE latin1_swedish_ci";

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.