รวมตารางได้แล้วครับ คือแบบนี้
$result = mysql_query("SELECT * FROM checking_info AS A INNER JOIN room_booking AS B ON (A.booking_id = B.booking_id) where A.booking_id='00041'");
แต่ทีนี้พอจะดึงข้อมูลออกมา มัน error ตรงนี้ครับ
while ($row=mysql_fetch_array($result))
{
...
}
$result = mysql_query("SELECT * FROM checking_info AS A INNER JOIN room_booking AS B ON (A.booking_id = B.booking_id) where booking_id='00042'");
while ($row=mysql_fetch_array($result)) // บรรทัดที่ 89
{
error นี้ครับ
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/HAM/get_bill.php on line 89
$sql="SELECT * FROM checking_info AS A INNER JOIN room_booking AS B ON (A.booking_id = B.booking_id) where A.booking_id='$booking_id' ";
$result=mysql_db_query($dbname,$sql);
$result = mysql_query("SELECT * FROM checkin_info, room_booking WHERE checkin_info.booking_id=room_booking.booking_id AND checkin_info.booking_id=$booking_id ");
while ($row=mysql_fetch_array($result))
{ .....
checkin_info คือตารางที่1
room_booking คือตารางที่2
แล้วใช้ WHERE ... AND เป็นตัวกรองตัวเลือกอีกที
ส่วนคำสั่ง INNER JOIN ผมต้องไปหาว่าผิดตรงไหน
ยังไงก็ ขอบคุณสำหรับทุกคำตอบ