Forum Moderators: coopster
I havent used arrays in PHP before (still learning - getting there).
Basically I have a table which contains the following 3 columns:
ID ¦ Value 1 ¦ Value 2
I have pulled all the values I need from the database and performed the necessary function on them, however I now need to insert these into an array.
I just need to know the code to drop in below:
------
while($row = mysql_fetch_array($result)){
# INSERT DATA AT BOTTOM OF ARRAY
}
----------
I would be thankful for any help received.
$count = 0;while($row = mysql_fetch_array($result)){
$myArray[$count][0] = $row[0]; //id
$myArray[$count][1] = $row[1]; // Value 1
$myArray[$count][2] = $row[2]; // Value 2$count++;
}
//printing the array
for($i = 0; $i < sizeof($myArray); $i++){
echo "\$myArray[$i][0]: ".$myArray[$i][0]."<br>";
}