创建数据库表单的解析/语法错误

时间:2016-07-13 03:36:28

标签: php html mysql

我收到一个Parse错误:语法错误,意外'['in(line).. 谁有解决方案?请看下面的php格式...我正在使用php版本4.6.3

<?php
    session_start();

        $db =mysqli_connect("localhost","username","password","database");
    include_once('db.php');
    if(isset($_POST['name_First'])&& isset($_POST['name_Last'])&& isset($_POST['name_Email'])&& isset($_POST['name_Phone'])) {
            if ($_POST['name_First']!="" && $_POST['name_Last']!="" && $_POST['name_Email']!="" && _POST['name_Phone']!=""){
                $first = $_POST['name_First'];
                $last = $_POST['name_Last'];
                $sql_store = "INSERT into coobacha (First,Last,Email,Phone) VARIABLES($First,$Last,NULL, NULL)";
                $sql = mysqli_query;{$db_store} or die(mysqli_error)();
    } else{
    echo "You need to fill out all fields...";
    } else{
        echo "You need to fill out all fields...";
        }

?>

2 个答案:

答案 0 :(得分:0)

VARIABLES替换为VALUES,试试这个:

$sql_store = "INSERT into coobacha (First,Last,Email,Phone) VALUES('$first','$last',NULL, NULL)";

更仔细地检查mysql语法INSERT

答案 1 :(得分:0)

你用那个

$sql_store = "INSERT into coobacha (First,Last,Email,Phone) VALUES('$First','$Last','', '')";