Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 30th, 2008, 05:49 AM
Authorized User
Join Date: Oct 2006
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to snowbydave1
Default Provide Searching from more than 60 tables

Hi Friends,

I want to provide searching of a text from more than 60 tables. If I established join with query then it will became very large query and I scare that it will not run on live server.

e.g. say I want to search "snowby" from database table then how shall I ? Because there is more than 60 tables in a database.

Is anybody have concreate idea about this...?

Thanks in advance

Snowby Dave

Old June 30th, 2008, 02:28 PM
Friend of Wrox
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts

JOIN wouldn't be right anyway.

You mean a UNION. And you COULD do that, but you are right, it would probably perform very badly.

I hate to say it, but likely the best way is to simply loop through all the tables, one at a time. Especially if you don't know which field (or fields) to search in each table until you query its schema.

But you *COULD* do a set of unions (e.g., 5 tables per union, so you only make 12 separate queries??), especially if some of the tables have similar structures. I'm not sure that would buy you tons of performance, but surely would get you some.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching multiple tables melkin Classic ASP Databases 0 March 10th, 2008 11:48 AM
SessionState timeout=60 -- Not working!!! angshujit ASP.NET 2.0 Basics 4 March 3rd, 2008 04:23 AM
searching tables ozPATT Access VBA 2 December 13th, 2005 05:16 AM
Controls New Class Library project page 60??? Ghistos BOOK: ASP.NET Website Programming Problem-Design-Solution 5 July 27th, 2004 10:40 PM
Hope if any one can provide some help RahilPatwa All Other Wrox Books 0 November 8th, 2003 01:31 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.