Question

I have a DBF - foxpro query and seems like I have an error, I am using codeIgniter and its feedback is just Fatal error: Call to a member function execute() on a non-object in D:\xampp\htdocs\accounting\system\database\drivers\pdo\pdo_driver.php on line 193 and I have encountered this error many times already and it means I have an error in my SQL but I cant figure out where. here are my tables

GUESTS

Guest ID | Guest_Name | Guest_Seat_No

   1   |    John     |      24

SEATS

Seat_No | Room_Location

  24   | 2nd Floor Room 11

HERE IS MY SQL QUERY

SELECT A.Guest_ID, A.Guest_Name, A.Guest_Seat_No, B.Room_Location
FROM GUESTS A JOIN SEATS B
ON A.Guest_Seat_No = B.Seat_No
WHERE A.Guest_ID = '1'

It seems there's something wrong in my query, its very difficult to determine the error because it just returns a fatal error generated by codeIgniter not the actual sql syntax error can someone please help me?

Was it helpful?

Solution

you should define what kind of JOIN type you are using, like INNER , LEFT, OUTER, FULL,

OTHER TIPS

SELECT A.Guest_ID, A.Guest_Name, A.Guest_Seat_No, B.Room_Location
FROM GUESTS AS A
JOIN SEATS AS B ON A.Guest_Seat_No = B.Seat_No
WHERE A.Guest_ID = '1'

Whew, I cant believe I got stuck on this just because of the word INNER in INNER JOIN I usually use just JOIN because knowing INNER JOIN is the default right? maybe DBF foxpro really wants the keyword INNER in JOIN statement :) strict fellow. Anyway Thanks to all of you for the help.

SELECT A.Guest_ID, A.Guest_Name, A.Guest_Seat_No, B.Room_Location
FROM GUESTS A INNER JOIN SEATS B
ON A.Guest_Seat_No = B.Seat_No
WHERE A.Guest_ID = '1'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top