daleGT Posted February 12, 2013 Share Posted February 12, 2013 Hey People. Im obviously a newbie. Can someone help me with an sqlget This is what im currently using (it worked fine until people have added so many records it takes awhile to load) $sqlget = "SELECT * FROM `XAGT` WHERE `input_body` = 'sedan' ORDER BY `input_build` ASC"; Now what im trying to do is filter it by year "input_vin" records are in a format like "JG33Mabcdefg" the portion of the record that is equal to a year is "JG33M" = 1972 for example. So im trying to pull out just 1972 records. trying something like $sqlget = "SELECT * FROM `XAGT` WHERE `input_body` = 'sedan' WHERE `input_vin` = 'JG33M' ORDER BY `input_build` ASC"; any help would be great Quote Link to comment https://forums.phpfreaks.com/topic/274419-newbie-help/ Share on other sites More sharing options...
daleGT Posted February 12, 2013 Author Share Posted February 12, 2013 sorry. input_vin is also input_build Quote Link to comment https://forums.phpfreaks.com/topic/274419-newbie-help/#findComment-1412096 Share on other sites More sharing options...
PaulRyan Posted February 12, 2013 Share Posted February 12, 2013 (edited) $sqlget = "SELECT * FROM `XAGT` WHERE `input_body` = 'sedan' WHERE `input_vin` LIKE 'JG33M%' ORDER BY `input_build` ASC"; Edited February 12, 2013 by PaulRyan Quote Link to comment https://forums.phpfreaks.com/topic/274419-newbie-help/#findComment-1412099 Share on other sites More sharing options...
Jessica Posted February 12, 2013 Share Posted February 12, 2013 You can't have two WHERE clauses. You can use AND. Quote Link to comment https://forums.phpfreaks.com/topic/274419-newbie-help/#findComment-1412105 Share on other sites More sharing options...
daleGT Posted February 13, 2013 Author Share Posted February 13, 2013 Paul thanks for the response $sqlget = "SELECT * FROM `XAGT` WHERE `input_body` = 'sedan' WHERE `input_body` LIKE 'JG33M%' ORDER BY `input_build` ASC"; gives an error getting (not sure if its because i gave you the wrong details in the first post) input_vin is supposed to be input_body, I did try to edit the post! I tried this based on your last post. $sqlget = "SELECT * FROM `XAGT` WHERE `input_body` = 'sedan' LIKE `input_build` = 'JG33M%' ORDER BY `input_build` ASC"; it does not return any records - but without error i checked the field & data and i do have results that should show up! Quote Link to comment https://forums.phpfreaks.com/topic/274419-newbie-help/#findComment-1412107 Share on other sites More sharing options...
daleGT Posted February 13, 2013 Author Share Posted February 13, 2013 okie got it, this one works $sqlget = "SELECT * FROM `XAGT` WHERE `input_body` = 'sedan' AND `input_build` LIKE 'JG33N%' ORDER BY `input_build` ASC"; thanks Paul & Jess Quote Link to comment https://forums.phpfreaks.com/topic/274419-newbie-help/#findComment-1412110 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.