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? 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? 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 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"; 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. 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"; Link to comment https://forums.phpfreaks.com/topic/153417-query-help/#findComment-806036 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.