dreamweaver / mysql / php - 表名不正确

问题描述 投票:-1回答:4

对不起,我真的非常新的php / mysql / dreamweaver。我尝试将我的order.php链接到数据库,当我在服务器上打开然后点击sumbit,有'不正确的表名'“'有人可以帮助我

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "order")) {
  $insertSQL = sprintf("INSERT INTO ``order`` (Username, Name, Email, Address, PhoneNumber, `Size`, OrderItem, Quantity) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['Username'], "text"),
                       GetSQLValueString($_POST['Name'], "text"),
                       GetSQLValueString($_POST['Email'], "text"),
                       GetSQLValueString($_POST['Address'], "text"),
                       GetSQLValueString($_POST['PhoneNumber'], "int"),
                       GetSQLValueString($_POST['Size'], "int"),
                       GetSQLValueString($_POST['OrderItem'], "text"),
                       GetSQLValueString($_POST['Quantity'], "text"));

  mysql_select_db($database_Assignment2, $Assignment2);
  $Result1 = mysql_query($insertSQL, $Assignment2) or die(mysql_error());
}
php mysql dreamweaver
4个回答
-1
投票

而不是这个:

INSERT INTO ``order``

你需要这样做:

INSERT INTO `order`

0
投票
$insertSQL = sprintf("INSERT INTO `order` (Username, Name, Email, Address, PhoneNumber, `Size`, OrderItem, Quantity) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['Username'], "text"),
                       GetSQLValueString($_POST['Name'], "text"),
                       GetSQLValueString($_POST['Email'], "text"),
                       GetSQLValueString($_POST['Address'], "text"),
                       GetSQLValueString($_POST['PhoneNumber'], "int"),
                       GetSQLValueString($_POST['Size'], "int"),
                       GetSQLValueString($_POST['OrderItem'], "text"),
                       GetSQLValueString($_POST['Quantity'], "text"));

请试试这个


0
投票

在您的查询$insertSQL = sprintf("INSERT INTO ``order`` (Username中进行更正,如$insertSQL = sprintf("INSERT INTOorder(Username


0
投票

而不是这个:

插入order

你需要这样做:

插入order

© www.soinside.com 2019 - 2024. All rights reserved.