Click to See Complete Forum and Search --> : SQL with 3 conditions...


pinoywebdev
March 22nd, 2008, 01:01 AM
$sql = "select schedule.* from schedule where schedule.street LIKE '%$stname%' AND schedule.number='$stnumber' AND schedule.type='$sttype' ";

When I am doing the sql as shown above... it could not select the record although it is there.

When I do it this way:

$sql = "select schedule.* from schedule where schedule.street LIKE '%$stname%' AND schedule.number='$stnumber'";

It can select the record.

Why is it?

Does having AND'ng 3 conditions does not work in mysql?

PeejAvery
March 22nd, 2008, 05:15 PM
There is nothing wrong with your query. The data must be different from what you are querying. Echo that query and then copy and past it into phpMyAdmin to see if you get a return.

gilly914
March 31st, 2008, 03:56 AM
I have queries with 5 conditions, and maybe even more, that have fully worked in the past...

So there can't be any problem with the query conditions, try testing in phpmyadmin or SQL Query Browser like Peejavery suggested...