0
$urunarray = array();
$urunliste = mysql_query("SELECT * FROM urunler");
while($urunlistev = mysql_fetch_array($urunliste)){
    $urunlid=$urunlistev['id'];
    array_push($urunarray, "urunid"=>"".$urunlid."", "adet"=>"0", "para"=>"0"); 
    $sepettliste = mysql_query("SELECT * FROM sepet WHERE urunid='".$urunlid"' AND sipariscode!=''");
    while($sepettlistev = mysql_fetch_array($sepettliste)){
        $urunlsipcode=$sepettlistev['sipariscode'];
        $sipliste = mysql_query("SELECT * FROM siparis WHERE code='".$urunlsipcode"'");
        $siplistev = mysql_fetch_array($sipliste);
        $urunlsubeid=$sepettlistev['subeid'];
        if($_SESSION['subesecimi'] == "" || strstr($subesecimi, $urunlsubeid)){
        }
    }
}

syntax error, unexpected '=>' (T_DOUBLE_ARROW)

I'm getting this error. I think array_push doesnt work like that but how can I add like this to the array?

Barmar
  • 741,623
  • 53
  • 500
  • 612
  • Change `array_push($urunarray, "urunid" => "".$urunlid."", "adet" => "0", "para" => "0"); ` to `array_push($urunarray, "urunid" => $urunlid, "adet" => "0", "para" => "0"); ` – Murad Hasan May 26 '16 at 15:46
  • 1
    Missing square braces `array_push($urunarray, ["urunid"=>$urunlid, "adet"=>"0", "para"=>"0"]);` or `array(..)` for old php: `array_push($urunarray, array("urunid"=>$urunlid, "adet"=>"0", "para"=>"0"));` – Steve May 26 '16 at 15:47
  • That should it be: `array_push($urunarray, array("urunid"=>$urunlid, "adet"=>"0", "para"=>"0")); ` => is an array notation so you have to have array ;) – nospor May 26 '16 at 15:47
  • 1
    @FrayneKonok That's the same syntax error as in the original code. – Barmar May 26 '16 at 16:29

0 Answers0