Welcome Guest, Not a member yet? Register   Sign In
Looping through mysql queries?
#6

[eluser]Guest[/eluser]
Ok, i've worked it out :coolsmile:

If you want to display the items in the order of the array - you need to use this:

ORDER BY FIELD(PersonalPage,' . $arr_result . ')

Example:

Code:
$arr_result = $this->db->query('SELECT DISTINCT PersonalPage FROM TBL_USERS WHERE UserName = \'BOB\' LIMIT 1')->result_array();
$arr_result = $this->db->query('SELECT itemName FROM TBL_ITEMS WHERE itemID IN ('. $arr_result[0]['PersonalPage'].') ORDER BY FIELD(PersonalPage,' . $arr_result . ')')->result_array();

print_r($arr_result);

Hope this helps anyone else that ever needs it.

Thanks again Dirk for the help :-)


Messages In This Thread
Looping through mysql queries? - by El Forum - 02-14-2010, 06:03 AM
Looping through mysql queries? - by El Forum - 02-14-2010, 07:38 AM
Looping through mysql queries? - by El Forum - 02-14-2010, 08:00 AM
Looping through mysql queries? - by El Forum - 02-14-2010, 08:26 AM
Looping through mysql queries? - by El Forum - 02-14-2010, 01:56 PM
Looping through mysql queries? - by El Forum - 02-15-2010, 12:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB