在不带Post(PHP)的数据库中插入整数数据


Inserting an integer data in Database without Post (PHP)

在编码方面,我是个初学者,但我希望每次注册时都能自动将这些值添加到数据库中。当我尝试输入代码时,我得到的只是:

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');
        }

谢谢。

1 ['level'];

这种类型的语法在php中不可用

删除[]及其内容