I am trying to fill an array from a MySQL database that is already populated, then I want to manipulate the data within the array rather than referring back to the db all the time - a fairly standard practice, I'm sure.
But I'm struggling to get it to work. The code below shows that data is filling the array from the database (part 1), but part 2 prints nothing, where I would expect it to print the clubid and clubname variables for each row in the array. Can anyone put me out of my misery please?
Code: Select all
<?php
/* part 1 */
while ( $ClubRow = @ mysql_fetch_array($ClubQuery) )
{
/* Fill array here */
$squad = array("$index" => array(
"clubid" => $ClubRow[0],
"clubname" => $ClubRow[1],
"country" => $ClubRow[2],
"balls" => $ClubRow[3],
"defpts" => $ClubRow[4],
"midpts" => $ClubRow[5],
"attpts" => $ClubRow[6],
"uefacomp" => $ClubRow[7]));
echo $index;
echo $squad[$index]['clubname'];
echo $squad[$index]['country'];
$index=$index+1;
}
/* part 2*/
for($index=1; $index<300; $index++)
{
$squad[$index]['clubid'] .
$squad[$index]['clubname'];
}
?>Code: Select all
tags :: [/color][url=http://forums.devnetwork.net/viewtopic.php?t=21171][color=red]:arrow: [u][b]Posting Code in the Forums[/b][/u][/color][/url]