Jump to content


Photo

Spaces in php character string for MySQL query...


  • Please log in to reply
1 reply to this topic

#1 jwwceo

jwwceo
  • Members
  • PipPipPip
  • Advanced Member
  • 212 posts

Posted 05 September 2006 - 10:53 AM

I have the following variable in my php code.

$data = mysql_query("SELECT * FROM shirts WHERE active='true' ORDER BY '$field' '$direction'; ");

at the end of this line of code there are two variables; $field and $direction.

The query is not working right because there is no space between the two when php passes the query into MySQL.

How do I insert a break in there so this query will work????


#2 zawadi

zawadi
  • Members
  • PipPip
  • Member
  • 25 posts
  • LocationChippenham UK

Posted 05 September 2006 - 11:40 AM

$data = mysql_query("SELECT * FROM shirts WHERE active='true' ORDER BY '$field','$direction'");
That's the beauty of asymmetric warfare. You don't need a lot of money, or an army of people. You can do it from the comfort of your living room, with a beer in your hand.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users