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 2 of 2
  1. #1
    New Coder
    Join Date
    May 2010
    Posts
    79
    Thanks
    15
    Thanked 2 Times in 2 Posts

    Best method to search to two tables?

    Hi guys!

    I wanted to make a search module that searches two tables, is it possible with only one query? I also thought of maybe dumping the tables, then just make a loop to search through it. Is it a wise idea?

    Any suggestions? Thanks!

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    SQL's job is to search. Don't give that burden to PHP since its a lot slower, so it would be very unwise to select an entire table's recordset and then use PHP to search it.

    You can search multiple tables either by using a join, or by using a union. Haven't a clue what you are searching for, so cannot suggest either or.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • Users who have thanked Fou-Lu for this post:

    kenshn111 (01-20-2013)


  •  

    Posting Permissions

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