我需要你的帮助来解决我的问题。首先我在 mysql dbase 中有 2 个表。这里是结构:
doctor1:
--------
no_que autoincrement pk,
doctor_name,
id_patient,
date,
time
status_que:
----------
id_patient,
doctor_name,
no_que fk,
date,
time
我想将数据插入到 doctor1 中,status_que 中的数据将相同。
$idp=$_POST['id_patient'];
$dt=$_POST['date'];
$tm=$_POST['time'];
$dn=$_POST['doctor_name'];
$query = "INSERT INTO doctor1 (doctor_name, id_patient, date, time)
values ('$dn', '$idp', '$dt', '$tm')";
$result = @mysql_query($query) or die("REPORT Failed to save data.");
$last_insert_no_que = mysql_insert_id();
@query2 = "INSERT INTO status_queue (id_patient, doctor_name, no_que, date, time)
values ('$idp', '$dn', '$last_insert_no_que', '$dt', '$tm')";
$result = @mysql_query($query2) or die("REPORT Failed to save data.");
但该代码不起作用