แบบนี้ป่าว
$sql="SELECT type_req_id FROM tbl_type_req WHERE type_req_id_refer = 10 (รับค่าจาก textbox)";
$query_sql=mysql_query($sql);
$fetch_sql=db_fetch_array($query_sql)
$type_req_id=$fetch_sql['type_req_id'];
INSERT INTO tbl_req_student (recvid,date_document,student_id,subject,type_req_id,status,remark,cancel)
VALUES ('201500983','2015-01-26','44053350','xxxxxxxxxxxx','$type_req_id','1','','0
Date :
2015-01-28 14:48:08
By :
pgm
No. 5
Guest
ทำแบบนี้ได้เลยครับ เป็นการ INSERT แบบ SELECT
INSERT INTO tbl_req_student (recvid,date_document,student_id,subject,type_req_id,status,remark,cancel)
VALUES ('201500983','2015-01-26','44053350','xxxxxxxxxxxx',(SELECT type_req_id FROM tbl_type_req WHERE type_req_id_refer = 10),'1','','0')
ข้อความ error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\RequestNotetest\save.php on line 94 ส่วนนี้ครับ -->$fetch_sql=mysql_fetch_array($query_sql);<--
Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '''','1','','0')'., SQL state 37000 in SQLExecDirect in C:\AppServ\www\RequestNotetest\save.php on line 117