Thanks all I 'm going to look into using one query as advised, but for now I'm still after a little help on this though if that's OK please.
I'm still getting a litte confused on arrays. I thought i'd solved what I was trying to do based on the kind advice offered here, but it's not working.
If I have a simple array like so
PHP Code:
$people = array(
'John',
'Mark'
);
Then for each element in the array I run through as kindly advised
PHP Code:
foreach($people as $person) {
$sql = "Select id from table WHERE name = '$person'";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)) {
$ids[$person][] = $row;
print_r($ids);
}
}
It shows some results. But say John has 9 id's associated with his name, I get the first 'id' in one array, then that same id repeated in the next array with the next value as well and so on as per the example below
Code:
Array
(
[John] => Array
(
[0] => Array
(
[0] => 5066
[id] => 5066
)
)
)
Array
(
[John] => Array
(
[0] => Array
(
[0] => 5066
[id] => 5066
)
[1] => Array
(
[0] => 5837
[id] => 5837
)
)
)
When I want them all to be shown in the one 'John' array. Then show me the next set of results in one 'Mark' array?
Can anyone please offer any help? Thank you