在编码方面我是初学者,但我想在每次有人注册时自动将这些值添加到数据库中。当我尝试输入代码时,我得到的只是:
Parse error: syntax error, unexpected '[' in C:\ -----\ ---\ -------\register.php on line 16
这是代码:
$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');
}
谢谢。