dreamweaver/mysql/php - table 名称不正确
dreamweaver/mysql/php - incorrect table name
对不起,我对 php/mysql/dreamweaver 真的很陌生。我尝试 link 我的 order.php 到数据库,当我在服务器上打开然后单击 sumbit 时,有 'incorrect table name ""' 有人可以帮助我
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());
}
$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"));
请试试这个
更正您的查询 $insertSQL = sprintf("INSERT INTO ``order`` (Username
像这样 $insertSQL = sprintf("INSERT INTO
order(Username
而不是这个:
INSERT INTO ``order``
您需要做的:
INSERT INTO `order`
而不是这个:
插入 order
您需要做的:
插入 order
对不起,我对 php/mysql/dreamweaver 真的很陌生。我尝试 link 我的 order.php 到数据库,当我在服务器上打开然后单击 sumbit 时,有 'incorrect table name ""' 有人可以帮助我
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());
}
$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"));
请试试这个
更正您的查询 $insertSQL = sprintf("INSERT INTO ``order`` (Username
像这样 $insertSQL = sprintf("INSERT INTO
order(Username
而不是这个:
INSERT INTO ``order``
您需要做的:
INSERT INTO `order`
而不是这个:
插入 order
您需要做的:
插入 order