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 Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/231176-syntax-statements/#findComment-1190336 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.