phpisawesome Posted April 10, 2009 Share Posted April 10, 2009 why can't I put a WHERE and ORDER BY in the same query? or is there a way? Quote Link to comment https://forums.phpfreaks.com/topic/153417-query-help/ Share on other sites More sharing options...
Maq Posted April 10, 2009 Share Posted April 10, 2009 why can't I put a WHERE and ORDER BY in the same query? or is there a way? You can, there is a way. Query please? Quote Link to comment https://forums.phpfreaks.com/topic/153417-query-help/#findComment-806030 Share on other sites More sharing options...
MasterACE14 Posted April 10, 2009 Share Posted April 10, 2009 <?php $query = "SELECT * FROM `table` WHERE `something`='somethingelse' ORDER BY `somecolumn`"; ?> Regards, ACE Quote Link to comment https://forums.phpfreaks.com/topic/153417-query-help/#findComment-806031 Share on other sites More sharing options...
phpisawesome Posted April 10, 2009 Author Share Posted April 10, 2009 $sql = "SELECT * FROM $tbl_name WHERE category = $category ORDER BY thumbs_delta DESC"; Quote Link to comment https://forums.phpfreaks.com/topic/153417-query-help/#findComment-806032 Share on other sites More sharing options...
Maq Posted April 10, 2009 Share Posted April 10, 2009 And please don't double post... Could you mark your other thread as [sOLVED] so people don't waste their time looking at it. This one as well. Quote Link to comment https://forums.phpfreaks.com/topic/153417-query-help/#findComment-806035 Share on other sites More sharing options...
Maq Posted April 10, 2009 Share Posted April 10, 2009 Looks fine except for adding the single quotes around $category... $sql = "SELECT * FROM $tbl_name WHERE category = '$category' ORDER BY thumbs_delta DESC"; Quote Link to comment https://forums.phpfreaks.com/topic/153417-query-help/#findComment-806036 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.