Hey guys, i'm a newbie to php coding and having so difficulties getting my code to work as i wish. My code is listed below:
foreach ($races as $race) {
$horseresult = mysql_query("SELECT DISTINCT * FROM Horse, RaceHorse WHERE Horse.HorseID = RaceHorse.HorseID AND ".$race." = RaceHorse.RaceID");
echo "</br>";
echo "Dealing with race id: $race";
echo "</br>";
$theloc = array_search($race, $races);
echo "THE $theloc </br>";
$races[$theloc] = $race => array();
print_r($races);
echo "</br>";
while($horsename = mysql_fetch_array($horseresult)) {
$thehorse = $horsename["HorseName"];
array_push($races[$theloc],$thehorse);
}
echo "</br>";
}
It doesn't like $races[$theloc] = $race => array();
it produces the error Parse error: syntax error, unexpected T_DOUBLE_ARROW in /u/u/ek237/public_html/horse_betting/final/bets/tempmakebet.php on line 45
I want this to work so the the race id (which is $race) we are looking at in the array full of races id ($races) is reassigned to be a key holding a value which is an array . Any ideas on how to overcome this problem, maybe an alternative way to doing this??
Thanks a bunch!