Hey all,
I have been searching for the last couple of days on how to do this (probably searching incorrect terms doesn't help 😛).
What I am trying to do, is fetch a row of data from my database, in this case 6 names, and place them into an array so that I can access them each individually
$arr[1] = name 1
$arr[2] = name 2
$arr[3] = name 3 .. and so on.
After searching and trying mysql_fetch_array/assoc/row (still not sure which one to use) I got up to
$result = mysql_query("SELECT `name` FROM `group` WHERE `EventID` = 4 LIMIT 6") or die(mysql_error());
while($data = mysql_fetch_array($result)) {
$arr[] = $data['name'];
print_r($arr);
Which spits out 6 progressing arrays:
Array ( [0] => NameOne )
Array ( [0] => NameOne [1] => NameTwo )
Array ( [0] => NameOne [1] => NameTwo [2] => NameThree )
...
...
Array ( [0] => NameOne [1] => NameTwo [2] => NameThree [3] => NameFour [4] => NameFive [6] => NameSix )
Cheers for any help