• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help with sql query

#3
[eluser]obiron2[/eluser]
Expanding on the above, what you need is a multi dimensional array:

The easiest way to do this is to generate a $objCountry=db->query() of the countries you want and then loop through each country record and build an array/object by running the query above setting $CountryId to the value in the $objCountry->row()

you want to build an array/object that looks like this:

$citylist = array(array(ID=>1,Code=>'UK',cities=>array('Birmingham','Bristol','Cardiff'...))
array(ID=>2,code=>'USA',cities=>array('Birmingham','Boston','Chicago'...))
...
)

you can then pass $citylist through your $data to your view
($data['citylist'] = $citylist

where you can then run for each loops on the nested data and format it however you want.

Best of luck

Obiron


Messages In This Thread
help with sql query - by El Forum - 08-19-2008, 11:15 PM
help with sql query - by El Forum - 08-19-2008, 11:35 PM
help with sql query - by El Forum - 08-20-2008, 06:40 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.