也許它只是我是一個noob,但對於我的生活我無法停止下面的代碼恢復到以下錯誤。MySQL語法錯誤的問題 - 不能解決它
Mysql error: 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 'WHERE id = 113' at line 4
ID(本例中爲ID 113)確實與數據庫匹配,但仍然沒有喜悅。
非常感謝您的幫助,我真的很感激它。
<?php
ob_start();
error_reporting(E_ALL & ~E_NOTICE);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
function isLoggedIn()
{
if(isset($_SESSION['valid']) && $_SESSION['valid'])
return true;
return false;
}
session_start();
//if the user has not logged in
if(!isLoggedIn())
{
header('Location: ../main');
die();
}
//! Checks that a restaurant is logged on
if ($_SESSION['user_type'] !== 'restaurant')
{
echo('You need to be a restaurant user to do that!, If you are seeing this message in error, please contact the system administrator.');
die();
}
//! Checks for direct access to page
if (empty($_GET)) {
header('location:../main/menu-manager.php?result=nothingentered');
die();
}
//! Get info from POST
$ID = $_GET['optionid'];
$rest_ID = $_SESSION['rest_id'];
//! security real escape
$ID = mysql_real_escape_string($ID);
//! Connect to the database
require_once('../Connections/PropSuite.php');
mysql_select_db($database_Takeaway, $Takeaway);
//! Write the information to the database
$query = "UPDATE menu_cats
SET rest_id = 'd.$rest_ID',
WHERE id = $ID ";
mysql_query($query);
if(mysql_errno() != 0){
// mysql error
// note: message like this should never appear to user, should be only stored in log
echo "Mysql error: " . htmlspecialchars(mysql_error());
die();
}
else {
header('Location: ../main/menu-manager.php?result=success');
}
?>
哇,這就是我得到使用複製和粘貼,傾斜的情況下,看到找,謝謝你的幫助 – AppleTattooGuy
@詹姆斯Leist,沒問題! –