Pim Jager showed much better way of doing this, but if you insist on using mysql_fetch_array():
$i = 0;
$size = count($row);
if ($size > 0) {
while ($i < floor($size / 2)) {
..... = $row[$i];
$i += 1;
}
}
Edit:
After reading again, I'm not sure if I quite understand the question.
If you have nested arrays for example:
$row = array('data1' => array('orange', 'banana', 'apple'),
'data2' => array('carrot', 'collard', 'pea'));
And you want to access each array then:
$data1 = $row['data1'];
// = array('orange', 'banana', 'apple')
$data2 = $row['data2'];
// = array('carrot', 'collard', 'pea')
// OR
$orange = $row['data1'][0];
$banana = $row['data1'][1];
$apple = $row['data1'][2];
$carrot = $row['data2'][0];
// ... so on..
Taking that in account the loop looks like this:
$i = 0;
$size = count($row);
if ($size > 0) {
while ($i < floor($size / 2)) {
$something = $row['data1'][$i]; //Or $row[0][$i]; using your example
$something = $row['data2'][$i]; //Or $row[1][$i]; using your example
$i += 1;
}
}
But I really suggest using mysql_fetch_assoc() and foreach loop, like in Pims Jagers example