anevins Posted March 20, 2011 Share Posted March 20, 2011 I'm having problems with the syntax of my SQL statement and I don't know how to solve it. SELECT * FROM stick, location, identification WHERE make LIKE '%$terms%' AND stick.sid = location.lid AND identification.stickID = stick.sid AND identification.id = $id" The problem is when I add: AND identification.id = $id As I need to define what $id is. How can I make a valid statement from this? Thanks Link to comment https://forums.phpfreaks.com/topic/231176-syntax-statements/ Share on other sites More sharing options...
The Little Guy Posted March 21, 2011 Share Posted March 21, 2011 SELECT * FROM stick LEFT JOIN location ON(stick.sid = location.lid) LEFT JOIN identification ON(identification.stickID = stick.sid) WHERE make LIKE '%$terms%' AND identification.id = $id Link to comment https://forums.phpfreaks.com/topic/231176-syntax-statements/#findComment-1190336 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.