$w = array($w['ssid'], $date, $w['hostname'], $w['ip'], ,$w['nickname'], $w['text'], $w['dialogID'], $w['money'], $w['score'], $w['pin'], $w['dname'], $_SERVER['remote_addr']); 

Mistake:

PHP Parse error: syntax error, unexpected ',', expecting ')'

Why does an error occur in this particular case? How can you similarly implement array filling?

  • four
    I suspect that this is the case: $w['ip'], ,$w['nickname'], - Regent

1 answer 1

You can not just take and miss the value. Try this:

 ..$w['ip'], NULL, $w['nickname'].. 

Alternatively, relying on variable processing :

 $w = explode(',', "$w[ssid],$date,$w[hostname],$w[ip],,$w[nickname],$w[text],$w[dialogID],$w[money],$w[score],$w[pin],$w[dname],$_SERVER[remote_addr]"); 

Here you can two commas in a row, because First, a string is formed with values ​​separated by commas, and then it beats onto an array, using commas as delimiters. But if one of the values ​​contains a comma, everything flies into tartars.

  • ugh, right, thank you. - Vitali RS
  • There was no meaning at all, even Null, it just seemed to poke a comma once again. - Vitali RS