Hi,
I have a mySQL result which is from a database of 9 columns and $x rows.
I need to create a loop so that it displays the content of each field in a row before going to a new line and then displaying that row.
The reason I am doing this is to cretae a loop system for adding data to an excel sheet I have created using COM. This works fine, its just a matter of looping through the results correctly.
here is the loop code I have at the minute (which isn't working correctly)
$x = 1;
for($i=1;$i<=8;$i++){
while($row = mysql_fetch_array($result)){
$cell = $sheets->Cells($i,$x);
$cell->activate;
$cell->value = $row[$x];
$x++;
}
}
$i is the row number and $x is the column
The code above displays the data in 1 row but it isnt looping through the other rows of the result
Any help is appreciated,
Thanks,
Martin