解析错误意外T_encapsed_and_whitespace,期望标识符t_string或变量t_variable,第15行

时间:2016-03-21 14:10:34

标签: php

不确定此行有什么问题请帮忙

$sql = "INSERT INTO Official (name,description) VALUES ('{mysqli->real_escape_string($_POST['name'])}' , '{mysqli->real_escape_string($_POST['Description'])} ')";

1 个答案:

答案 0 :(得分:0)

只是你的PHP语法错误,应该如下:

    $mysqli = new mysqli("server", "user", "password", "database");
    //---------------------
    // some other code here
    //---------------------
    $name = $mysqli->real_escape_string($_POST['name']);
    $desc = $mysqli->real_escape_string($_POST['Description']);
    $sql = "INSERT INTO Official (name, description) VALUES ('".$name."', '".$desc."')";