Jump to content

Mystery Error


abie

Recommended Posts

I can't find the error: Parse error: syntax error, unexpected T_STRING, expecting ']' in /xx/xx/xx/tap/submit_stats.php on line 4

 

I've look a lot but cannot find it.  Please help?

<?

$sql = "INSERT INTO tap (p_name, match_r, makes, misses, defensive, mob, lot, g_won, g_lost, dead_balls, 8_break, run, scratch_8, early_8, opp_level, opp_makes, opp_misses, opp_def, team_id)
VALUES ('$_POST[p_name]' , '$_POST[match_r]' , '$_POST[makes]' , '$_POST[misses]' , '$_POST[defensive]' , '$_POST[mob]' , '$_POST[lot]' , '$_POST[g_won]' , '$_POST[g_lost]' , '$_POST[dead_balls]' , '$_POST[8_break]' , '$_POST[run]' , '$_POST[scratch_8]' , '$_POST[early_8]' , '$_POST[opp_level]' , '$_POST[opp_makes]' , '$_POST[opp_misses]' , '$_POST[opp_def]' , '$_POST[team_id]');


if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}

print("Submitted");

?>

Link to comment
https://forums.phpfreaks.com/topic/178392-mystery-error/
Share on other sites

Ah, I see:

 

echo "$arr['something']"; // Invalid
echo $arr[something]; // Invalid
echo "$arr[something]"; //Valid
echo "{$arr['something']}"; //Also Valid

Seems a bit inconsistent (though I guess PHP is known for being notoriously inconsistent) , so I guess I'll stick with echo "{$arr['something']}"

Link to comment
https://forums.phpfreaks.com/topic/178392-mystery-error/#findComment-940766
Share on other sites

Archived

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.