genzedu777 Posted December 27, 2010 Share Posted December 27, 2010 Hi, I believe my coding has written wrongly, I am trying to retrieve 3 records at the same time, 'Tbjjtwx' '123456' '414221' SELECT * FROM `tutor`WHERE `Tutor_ID` = 'Tbjjtwx' && '123456' && '414221' //However no results were shown But when I tried to search for only 1 ID, result was shown SELECT * FROM `tutor`WHERE `Tutor_ID` = 'Tbjjtwx' Did I miss out anything? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/222728-command/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 27, 2010 Share Posted December 27, 2010 http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#function_in Quote Link to comment https://forums.phpfreaks.com/topic/222728-command/#findComment-1151777 Share on other sites More sharing options...
sangoku Posted December 27, 2010 Share Posted December 27, 2010 You may have noticed that that command is a logical command and that it is in notation of C++ language.... which almost all advanced lang. no longer support(me daydreaming). You could try and just write AND or OR or as the nice guy above me pointed out use the in case statement Quote Link to comment https://forums.phpfreaks.com/topic/222728-command/#findComment-1151785 Share on other sites More sharing options...
genzedu777 Posted December 28, 2010 Author Share Posted December 28, 2010 Hi guys, I'm still confused, after reading the link I'm even more lost. I have tried changing the && to AND, but it still doesn't work. Any idea? Thanks SELECT * FROM `tutor` WHERE `Tutor_ID` = 'Tcolez5' AND 'Tbjjtwx' AND 'Tn4f9ym' Quote Link to comment https://forums.phpfreaks.com/topic/222728-command/#findComment-1152113 Share on other sites More sharing options...
trq Posted December 28, 2010 Share Posted December 28, 2010 Either.... SELECT * FROM `tutor` WHERE `Tutor_ID` = 'Tcolez5' AND `Tutor_ID` = 'Tbjjtwx' AND `Tutor_ID` = 'Tn4f9ym'; Or as PFMaBiSmAd pointed out. SELECT * FROM `tutor` WHERE `Tutor_ID` IN('Tcolez5', 'Tbjjtwx', 'Tn4f9ym'); Quote Link to comment https://forums.phpfreaks.com/topic/222728-command/#findComment-1152116 Share on other sites More sharing options...
genzedu777 Posted December 28, 2010 Author Share Posted December 28, 2010 Thank you so much for the help! Quote Link to comment https://forums.phpfreaks.com/topic/222728-command/#findComment-1152174 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.