SELECT query returns no results for unknown reasons.
Posted: Thu Oct 09, 2008 9:07 pm
Hi everyone, I'm fairly new to this but have been making good progress until tonight.
I'm doing a simple PHP/MySQL SELECT query as I have done many many times now, only now I have added a new column to my 'bookings' table called 'deleted'. I have made a page where I can submit through and 'delete' a booking (actually puts a 'Y' in the deleted column). Obviously I now want to add a bit on my SQL query's that list my bookings that says something like...
However when I do this, I get absolutely no results! I currently have one booking out of about 30 with a Y, and adding this results in no results! Using:
returns 1 result as expected.
To summarise, here's a snippet of what does not work:
And here's the code which returns the one deleted result (the opposite of what I want!):
If anyone could give me a pointer I'd be eternally grateful, this is driving me mad now!
Thanks.
I'm doing a simple PHP/MySQL SELECT query as I have done many many times now, only now I have added a new column to my 'bookings' table called 'deleted'. I have made a page where I can submit through and 'delete' a booking (actually puts a 'Y' in the deleted column). Obviously I now want to add a bit on my SQL query's that list my bookings that says something like...
Code: Select all
WHERE deleted!='Y'Code: Select all
WHERE deleted='Y'To summarise, here's a snippet of what does not work:
Code: Select all
$query = "SELECT title, shortdesc, customerid, quotedate, quotetime, bookingid, frompostcode, topostcode, subcontractorid, podtime, poddate, podname, readytoinvoice, payamount FROM bookings WHERE ownerid='".$userid."' AND subcontractorid!='' AND podname!='' AND deleted!='Y'";
$result = mysql_query($query);Code: Select all
$query = "SELECT title, shortdesc, customerid, quotedate, quotetime, bookingid, frompostcode, topostcode, subcontractorid, podtime, poddate, podname, readytoinvoice, payamount FROM bookings WHERE ownerid='".$userid."' AND subcontractorid!='' AND podname!='' AND deleted='Y'";
$result = mysql_query($query);Thanks.