您的SQL语法中有错误(mySQL)

Mat*_*ght -1 php mysql insert-into

我之前已经问过这样的问题,我已经看过这些主题,但我的语法中似乎找不到错误 - 所以我转而发布自己的错误.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT_INTO users (uid,email,pass_hash,permissions,join_date) VALUES ('wright.ma' at line 1)
Run Code Online (Sandbox Code Playgroud)

我的代码如下,但其他一切似乎都有效,直到SQL,这对我来说是有效的.

  $email = $_POST['email'];
  $pass = $_POST['pass'];
  $pass2 = $_POST['pass2'];
  $uid = $_POST['uid'];
  $join_date = date("Y-m-d H:i:s");
  if ($_POST['permissions']) { $permissions = $_POST['permissions']; } else { $permissions = 0; }
  if (!$email) {
    header('HTTP/1.1 500 Internal Server Error');
    header('Content-Type: application/json');
    exit("Security Module Error - Email address not provided");
  }
  if (!$uid) {
    header('HTTP/1.1 500 Internal Server Error');
    header('Content-Type: application/json');
    exit("Security Module Error - User ID not provided");
  }
  if (!$pass || !$pass2 || ($pass != $pass2)) {
    header('HTTP/1.1 500 Internal Server Error');
    header('Content-Type: application/json');
    exit("Security Module Error - Password not provided or doesn't match");
  }
  $pass_hash = crypt($pass,'$1$$hash$1');

  $conn = @mysql_connect("localhost","root","root");
  if (!$conn) {
    header('HTTP/1.1 500 Internal Server Error');
    header('Content-Type: application/json');
    exit("Database Error - Unable to Connect");
  }
  $db = @mysql_select_db("start", $conn);
  if (!$db) {
    header('HTTP/1.1 500 Internal Server Error');
    header('Content-Type: application/json');
    exit("Database Error - Unable to Access Database");
  }
  $result = @mysql_query("INSERT_INTO users (uid,email,pass_hash,permissions,join_date) VALUES ('$uid','$email','$pass_hash','$permissions',$join_date)");
  if (!$result) {
    header('HTTP/1.1 500 Internal Server Error');
    header('Content-Type: application/json');
    exit("Database Error - Unable to Create Record (".mysql_error($conn).")");
  }
  $row = mysql_fetch_array($result);
  if (!$row) {
    header('HTTP/1.1 500 Internal Server Error');
    header('Content-Type: application/json');
    exit("Security Module Error - Unable to Authenticate Record Creation");
  } else {
    $_SESSION['uid'] = $row['uid'];
    $_SESSION['permissions'] = $row['permissions'];
    $_SESSION['email'] = $row['email'];
  }
Run Code Online (Sandbox Code Playgroud)

第二组愿意提供帮助的人将不胜感激!

Rob*_*ert 5

你有一个下划线分隔INSERT和INTO.语法应为"INSERT INTO ...."

您还应该考虑使用PDO或mysqli,因为不推荐使用mysql_*函数.