當我從表book
更新book_Status
到AVAILABLE
我沒有成功將reserve_Status
更改爲RESERVED
。我的腳本有什麼問題?插入數據庫條件
reserve.php:
<?php
include 'dbconnect.php';
$query1 ="
SELECT b.book_Status, r.reserve_Status
FROM book b
JOIN reservations r
ON r.book_Accession = b.book_Accession
";
$result1 = mysql_query($query1) or die('SQL error');
$row1 = mysql_fetch_array($result1, MYSQL_ASSOC);
if ($row1['book_Status'] == 'Available')
{
$Reserved = "Reserved";
}
$query2 = "INSERT INTO reservations
WHERE reserve_Status = '$Reserved' ";
?>
請詳細解釋你想做什麼!你不能用'WHERE'子句插入。插入只是插入他們爲什麼會有一個地方。 – CodeBird 2014-10-31 08:41:43
請發表您要使用 – Alepac 2014-10-31 08:42:59
提示表的完整結構:你應該做一個'UPDATE'查詢,而不是插入 – 2014-10-31 08:43:56