[PHP] Order by

Si Jones si at bananas.hopto.org
Wed Aug 4 20:56:08 UTC 2004


>start the quotes again...
>
>$specs_query = mysql_query("select title, information from spec where
>product=".$id." order by id asc");
>
>  
>
Why do you split the string?

When all you need to do is

$specs_query = mysql_query("select title, information from spec where

product = $id order by id asc");

because your using " and not ' it will fill the varible in for you.

If it was a string and you need to surround the string then it would be

$specs_query = mysql_query("select title, information from spec where

product = '{$id}' order by id asc");

That would fill the variable in and the single quotes required for sql.

Regards,






More information about the fedora-list mailing list