Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2010
    Posts
    61
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Multiple select like

    Im trying to do multiple %like and keeps crashing?

    Code:
    // Select records from database  
    $query = "SELECT * FROM customers WHERE Bus_Name like '%$trimmed%', 
      FirstName like '%$trimmed%' ORDER BY Bus_Name";

  • #2
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    you are missing OR!

    Code:
    WHERE Bus_Name like '%$trimmed%' OR FirstName like '%$trimmed%' 
    OR LastName like '%$trimmed%' OR SerialNo like '%$trimmed%' 
    ORDER BY Bus_Name";

  • Users who have thanked DataTalk for this post:

    CloudWriter (12-29-2010)

  • #3
    New Coder
    Join Date
    Dec 2010
    Posts
    61
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DataTalk View Post
    you are missing OR!

    Code:
    WHERE Bus_Name like '%$trimmed%' OR FirstName like '%$trimmed%' 
    OR LastName like '%$trimmed%' OR SerialNo like '%$trimmed%' 
    ORDER BY Bus_Name";

    Thanks, that works!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •