0
我正在設計一個預約系統,我需要知道當另一個用戶已經接受預約時,如何從數據庫中刪除約會(因此不再顯示)。從數據庫中刪除數據
<?php
{
mysql_connect("localhost" , "" , "" or die (mysql_error());
mysql_select_db("") or die(mysql_error());
$pid=intval($_SESSION["Patient_id"]); $query = "SELECT t1.*, t2.Doctor_name, t2.Doctor_room FROM Appointment AS t1 INNER JOIN Doctor AS t2 ON t1.Doctor_id=t2.Doctor_id";
//executes query on the database
$result = mysql_query ($query) or die ("didn't query");
//this selects the results as rows
$num = mysql_num_rows ($result);
//if there is only 1 result returned than the data is ok
if ($num == 1) {}
{
$row=mysql_fetch_array($result);
$_SESSION['Appointment_date'] = $row['Appointment_date'];
$_SESSION['Appointment_time'] = $row['Appointment_time'];
$_SESSION['Doctor_name'] = $row['Doctor_name'];
$_SESSION['Doctor_room'] = $row['Doctor_room'];
}
}
上面的代碼目前允許用戶預約。我需要時間和日期不顯示,如果它已被採取。
謝謝!
您使用的是如果約會是採取標記和表中沒有..和哪場並且請糾正你假設的第一條線mysql_connect(「localhost」,「」,「」)或死(mysql_error());'? – alwaysLearn
[mysql_ *](http://news.php.net/php.internals/53799)擴展名已被棄用,您應該使用[PDO](http://php.net/manual/en/book.pdo .php)或[mysqli](http://php.net/manual/en/book.mysqli.php)。 – doublesharp
顯示我的表你的SQL結構'Appointment' – shnisaka