Dear Joseph, Thank you for your quick reply. The MERGE function may do the trick but then I would have to type the name of the 50 tables ! The idea was to avoid having to type evey single table. Also, what will happen if new tables are created ? I'll have to re-merge them all ?
P.L. >From: Joseph Bueno <[EMAIL PROTECTED]> >To: Pascale Lunal <[EMAIL PROTECTED]> >CC: [EMAIL PROTECTED] >Subject: Re: PHP search query into all tables of a MySQL db >Date: Thu, 26 Sep 2002 12:04:53 +0200 > >Pascale Lunal wrote: >>Oops: sorry if this message appears twice but my connection broke down >>just when I clicked 'send'. >> >>Hello, >> >>I am currently writing a search query in PHP to: >> >>1. search in MySQL database (not in one table but in all the tables of the >>whole database), >> >>2. search when more than one searchterm is entered (it works for 1 search >>term but not for more). >> >>My questions related to the above two points are: >> >>1. How do I modify the following line (basically how to change "mytable" >>to "allmytable") so that all the tables are searched (each table has >>exactly the same structure) wihtout having to type every single table name >>(since I have 50 of them !) ? >> >>$query = "SELECT * FROM mytable WHERE columnname LIKE '%$searchterm%'"; >> >Since all your tables have the same structure, you can create a "merge >table" and run your select on it. > >>2. The search is performed by typing the word to be searched. This works >>for 1 word but not if I enter more than 1 term. How can I make a multiple >>word search ? > >You should split your $searchterm in multiple words and build a query >that looks like: >SELECT * FROM mytable WHERE columnname LIKE '%$word1%' AND columnname >LIKE '%$word2%'... >(Sorry for not beeing more specific but it is a PHP, not MySQL, problem >and I have no experience in PHP). > >> >>Any help, example scripts, tutorials would be greatly appreciated. >> >>Best regards, >> >>Pascale >> >Regards >-- >Joseph Bueno _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php