Jump to content

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

        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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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