Reputation: 1
I am a beginner when it comes to coding, but I want to automatically add these values to the database every time a person registers. When I try to enter the code all I get is:
Parse error: syntax error, unexpected '[' in C:\ -----\ ---\ -------\register.php on line 16
Here is the code:
$level = 1 ['level'];
$money = 500 ['money'];
$current_health = 100 ['current_health'];
$max_health = 100 ['max_health'];
$query = "INSERT INTO users VALUES ('',
'".mysql_real_escape_string($level)."',
'".mysql_real_escape_string($money)."',
'".mysql_real_escape_string($current_health)."',
'".mysql_real_escape_string($max_health)."')";
if ($query_run = mysql_query($query)) {
header ('Location: register_success.php');
}
Thanks.
Upvotes: 0
Views: 69
Reputation: 1556
1 ['level'];
this type of syntax is not available in php
remove [ ] with its content
Upvotes: 1