Cyto Posted December 5, 2011 Share Posted December 5, 2011 Hi, Is it possible to order by the first letter of name? Data is coming from a post value. $qorder = substr($q,0,1); SELECT * FROM data WHERE name LIKE '%$q%' OR info LIKE '%$q%' Want something like this: ORDER BY name='$qorder%', but doesnt work Thx, Quote Link to comment Share on other sites More sharing options...
Pandemikk Posted December 5, 2011 Share Posted December 5, 2011 ORDER BY ASC Quote Link to comment Share on other sites More sharing options...
sunfighter Posted December 5, 2011 Share Posted December 5, 2011 ORDER BY "column_name" [ASC, DESC] Quote Link to comment Share on other sites More sharing options...
Cyto Posted December 5, 2011 Author Share Posted December 5, 2011 I mean order by the value from post, so when the value is Santa. I want to order by S of Santa. Quote Link to comment Share on other sites More sharing options...
xyph Posted December 5, 2011 Share Posted December 5, 2011 SELECT `columns` FROM `table` WHERE `column` LIKE 's%' Quote Link to comment Share on other sites More sharing options...
Cyto Posted December 5, 2011 Author Share Posted December 5, 2011 SELECT `columns` FROM `table` WHERE `column` LIKE 's%' --- nvm --- Thx LIKE '$q%' works. Quote Link to comment 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.