swimmerphil1 Posted August 1, 2007 Share Posted August 1, 2007 Hi all. thanks in advance. Here is the issue ive run into. I perform a mysql_query with multiple OR arguments i.e. "SELECT * FROM `someTableName` WHERE `zipCode` LIKE 'zipCode1' OR `zipCode` LIKE 'zipCode2' OR ....; Is there any way to perform the mysql_query such that the returned rows can be outputted in the same order in which i listed the parameter zipCodeX, where X = 1,2,3.... i.e. if i have 3 rows that are returned from the query: row 1 has zipCode = zipCode2 row 2 has zipCode = zipCode3 row 3 has zipCode = zipCode1 then how can i easily sort/maniuplate the data so that I can output the information from each respective row in the following order: row 3 data.... row 1 data ... row 2 data.... Thanks again! Regards, Phil Quote Link to comment https://forums.phpfreaks.com/topic/62777-sorting-mysql_query-with-multiple-or-arguments/ Share on other sites More sharing options...
btherl Posted August 1, 2007 Share Posted August 1, 2007 Is there any way to perform the mysql_query such that the returned rows can be outputted in the same order in which i listed the parameter zipCodeX, where X = 1,2,3.... No, but ... ORDER BY zipCode at the end of your query should give you the ordering you want. But this is nothing to do with the order you listed the parameters in the query. It's to do with the values in the zipCode column. Quote Link to comment https://forums.phpfreaks.com/topic/62777-sorting-mysql_query-with-multiple-or-arguments/#findComment-312563 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.