Jump to content


Photo

Need help placing variable in query


  • Please log in to reply
2 replies to this topic

#1 thisagain

thisagain
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 20 July 2006 - 04:29 PM

This query string works:


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



...but I want to make Trains 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

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 20 July 2006 - 04:31 PM

Use double quotes:
$query = "SELECT * FROM `models` WHERE `fname` = CONVERT(_utf8 '$fname' USING latin1) COLLATE latin1_swedish_ci";


#3 thisagain

thisagain
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 20 July 2006 - 04:37 PM

I feel stupid now.  But Thanks!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users