【发布时间】:2013-04-01 04:52:05
【问题描述】:
我正在设计一个预订系统,我需要知道当另一个用户已经接受该约会时,您将如何从数据库中删除约会(因此不再显示)。
<?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" , "" , "") or die (mysql_error());? -
显示我的表
Appointment的sql结构
标签: php mysql join inner-join