Jump to content

Archived

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

jwwceo

Spaces in php character string for MySQL query...

Recommended Posts

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????

Share this post


Link to post
Share on other sites
$data = mysql_query("SELECT * FROM shirts WHERE active='true' ORDER BY '$field','$direction'");

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.