Jump to content

ed.237

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ed.237's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.