Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-20-2013, 04:18 AM   PM User | #1
kenshn111
New Coder

 
Join Date: May 2010
Posts: 75
Thanks: 13
Thanked 2 Times in 2 Posts
kenshn111 is an unknown quantity at this point
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!
kenshn111 is offline   Reply With Quote
Old 01-20-2013, 04:48 AM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,645
Thanks: 4
Thanked 2,450 Times in 2,419 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
kenshn111 (01-20-2013)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:34 AM.


Advertisement
Log in to turn off these ads.