corbeeresearch Posted October 3, 2010 Share Posted October 3, 2010 Hi, I'm trying to count only data with yes and no, but it kept counting everything. what's wrong with my query? $count = 'select count(ans_id) from plus_poll_ans where opt="yes" or opt="no"'; Quote Link to comment https://forums.phpfreaks.com/topic/215020-count-specific-data/ Share on other sites More sharing options...
BlueSkyIS Posted October 3, 2010 Share Posted October 3, 2010 $count = "SELECT COUNT(ans_id) FROM plus_poll_ans WHERE opt='yes' AND opt='no'"; Quote Link to comment https://forums.phpfreaks.com/topic/215020-count-specific-data/#findComment-1118562 Share on other sites More sharing options...
fenway Posted October 5, 2010 Share Posted October 5, 2010 $count = "SELECT COUNT(ans_id) FROM plus_poll_ans WHERE opt='yes' AND opt='no'"; That doesn't make any sense -- opt can't be two different values at once. Hi, I'm trying to count only data with yes and no, but it kept counting everything. what's wrong with my query? $count = 'select count(ans_id) from plus_poll_ans where opt="yes" or opt="no"'; Shouldn't be anything -- are there any errors? Quote Link to comment https://forums.phpfreaks.com/topic/215020-count-specific-data/#findComment-1119257 Share on other sites More sharing options...
corbeeresearch Posted October 13, 2010 Author Share Posted October 13, 2010 Wow can't believe I missed that. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/215020-count-specific-data/#findComment-1121638 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.