Jump to content

unexpected T_DOUBLE_ARROW error when trying to modify an array


Recommended Posts

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();


        echo "</br>";


        while($horsename = mysql_fetch_array($horseresult)) {

            $thehorse = $horsename["HorseName"];



        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!

Link to post
Share on other sites


This topic is now archived and is closed to further replies.

  • 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.