realjumper Posted June 25, 2008 Share Posted June 25, 2008 Hi, If my query is..... $result = mysql_query("SELECT * FROM details WHERE status != 'Re-Submit' ORDER BY id desc") or die(mysql_error()); The results return are (predictably) everything that does not have 'Re-Submit' as it's status. Fine :-) If my query is..... $result = mysql_query("SELECT * FROM details WHERE status != 'Approved' ORDER BY id desc") or die(mysql_error()); Then the results returned are everything that does not have the status of 'Approved'. Also fine :-) But, when my query includes both conditions like this...... $result = mysql_query("SELECT * FROM details WHERE status != Re-Sumbit || status != 'Approved' ORDER BY id desc") or die(mysql_error()); Then the results include records that have the status of 'Re-Submit' and 'Approved'....which is what I'm trying to NOT include!! What did I miss? Link to comment https://forums.phpfreaks.com/topic/111939-select-with-conditions-error-of-some-sort/ Share on other sites More sharing options...
Caesar Posted June 25, 2008 Share Posted June 25, 2008 Try using the word "OR" vs using "||"...see how that works out, buddy. Link to comment https://forums.phpfreaks.com/topic/111939-select-with-conditions-error-of-some-sort/#findComment-574520 Share on other sites More sharing options...
realjumper Posted June 25, 2008 Author Share Posted June 25, 2008 Try using the word "OR" vs using "||"...see how that works out, buddy. Yup, been there, done that.....same result Link to comment https://forums.phpfreaks.com/topic/111939-select-with-conditions-error-of-some-sort/#findComment-574522 Share on other sites More sharing options...
trq Posted June 25, 2008 Share Posted June 25, 2008 $result = mysql_query("SELECT * FROM details WHERE status != 'Re-Sumbit' && status != 'Approved' ORDER BY id desc") Link to comment https://forums.phpfreaks.com/topic/111939-select-with-conditions-error-of-some-sort/#findComment-574524 Share on other sites More sharing options...
realjumper Posted June 25, 2008 Author Share Posted June 25, 2008 $result = mysql_query("SELECT * FROM details WHERE status != 'Re-Sumbit' && status != 'Approved' ORDER BY id desc") Yes of course.....you know....that's what I had originally but for some silly reason I changed it from 'and' to 'or'. Many thanks, saved me from this tired frustration :-) Link to comment https://forums.phpfreaks.com/topic/111939-select-with-conditions-error-of-some-sort/#findComment-574527 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.