MySQL ORDER BY FIELD does not working in CI 2.1.0 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: MySQL ORDER BY FIELD does not working in CI 2.1.0 (/showthread.php?tid=52620) |
MySQL ORDER BY FIELD does not working in CI 2.1.0 - El Forum - 06-19-2012 [eluser]foska[/eluser] Code: Error Number: 1305 Need help in this... MySQL ORDER BY FIELD does not working in CI 2.1.0 - El Forum - 06-19-2012 [eluser]foska[/eluser] hm... probably it`s hosting problem MySQL ORDER BY FIELD does not working in CI 2.1.0 - El Forum - 06-19-2012 [eluser]prakash[/eluser] do you want the results in order by id? if so use Code: SELECT `id`, `image`, `sex` FROM `users` WHERE `id` IN (28,35,40,34,33) ORDER BY id MySQL ORDER BY FIELD does not working in CI 2.1.0 - El Forum - 06-19-2012 [eluser]foska[/eluser] [quote author="prakash" date="1340102509"]do you want the results in order by id? if so use Code: SELECT `id`, `image`, `sex` FROM `users` WHERE `id` IN (28,35,40,34,33) ORDER BY id [/quote] Yes, but I want to save original ordering, as in "where in" section MySQL ORDER BY FIELD does not working in CI 2.1.0 - El Forum - 06-19-2012 [eluser]prakash[/eluser] if your number of records are less you can go with Code: SELECT `id`, `image`, `sex` FROM `users` WHERE `id` IN (28,35,40,34,33) ORDER BY id='28',id='35',id='40',id='34',id='33' MySQL ORDER BY FIELD does not working in CI 2.1.0 - El Forum - 06-19-2012 [eluser]foska[/eluser] it was problem in space between FIELD and ()... Now working |