jeffreyd65 Posted January 18, 2012 Share Posted January 18, 2012 I have a line in my php/sql programming, but can't figure out how to include a "ORDER BY" command. $database->setQuery('select `id`, `proj_no`, `proj_name` from t_proj_data where `prog_id`='.$group_id); Do I include it after the $group_id, if so, what would I use as a separator? I tried using a space only, but it didn't work. Any help would be greatly appreciated!! Link to comment Share on other sites More sharing options...
viper_ Posted January 18, 2012 Share Posted January 18, 2012 $database->setQuery('select `id`, `proj_no`, `proj_name` from t_proj_data where `prog_id`='.$group_id.' ORDER BY xxxxx'); should work..using the concatenation operator "." (dot).then you can add an ' ORDER BY xxxxx' string with a space at the beginning.. viper Link to comment Share on other sites More sharing options...
justsomeguy Posted January 18, 2012 Share Posted January 18, 2012 The dot operator is what you use to join strings, like you did before the $group_id variable. Spaces around the operators are optional. The ORDER BY clause goes at the end of that query. http://www.php.net/manual/en/language.operators.string.phphttp://www.w3schools.com/php/php_string.asp Link to comment Share on other sites More sharing options...
jeffreyd65 Posted January 18, 2012 Author Share Posted January 18, 2012 Great!! That worked perfectly. Thank you very much! JD Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.