Jump to content

Select with conditions error of some sort


realjumper

Recommended Posts

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?

 

 

$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 :-)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.