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
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
Share on other sites

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.