looping through a db and putting some info into array
Posted: Mon Apr 21, 2003 3:54 pm
i have a database called buildings with amongst other things, 3 important things:
xcord << x cooridinate
ycord << y cooridinate
status << either SOLD, forsale, or forrent
ive done my sql query and have a variable called $buildings with the entire result in.
what i would like to do is creat an array, ie:
$location[Xcord][Ycord] = status
but i cant work out the best way to get the information from the database and put it in this array.
i think will will probably have to use two nested foreach statments, but im not sure :/
hope someone can help
Tom
xcord << x cooridinate
ycord << y cooridinate
status << either SOLD, forsale, or forrent
ive done my sql query and have a variable called $buildings with the entire result in.
what i would like to do is creat an array, ie:
$location[Xcord][Ycord] = status
but i cant work out the best way to get the information from the database and put it in this array.
i think will will probably have to use two nested foreach statments, but im not sure :/
hope someone can help
Tom