Halisco Posted February 14, 2009 Share Posted February 14, 2009 I am trying to get results for the following. This satatement works: $result=mysql_db_query($base,"select * from ".$basesites." WHERE Field1 LIKE '%$SearchField1%' OR Field2 LIKE '%$SearchField2%' ORDER BY Field1" ,$link); This statement Doesn't work: $result=mysql_db_query($base,"select * from ".$basesites." WHERE Field1 LIKE '%$SearchField1%' OR Field2 LIKE '%$SearchField2%' AND Field3 LIKE '%$SearchField3%' ORDER BY LastName" ,$link); How do i create a statement that will give me result for either (Field1 OR Field2) AND Field3 Link to comment https://forums.phpfreaks.com/topic/145217-solved-mysql-with-and-or/ Share on other sites More sharing options...
Mchl Posted February 14, 2009 Share Posted February 14, 2009 Just like you wrote it (Field1 OR Field2) AND Field3 Use () in your query Link to comment https://forums.phpfreaks.com/topic/145217-solved-mysql-with-and-or/#findComment-762286 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.