RE: [PHP-DB] Running a search in many columns at once.
| From: | Mark Roedel | Date: | Fri, 07 Jul 2000 15:48:05 +0000 |
| Subject: | RE: [PHP-DB] Running a search in many columns at once. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-950@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: omer@omer [mailto:omer@omer]On Behalf Of Omer Barlas
> Sent: Friday, July 07, 2000 10:24 AM
> To: php-db@lists.php.net
> Subject: [PHP-DB] Running a search in many columns at once.
>
>
> I have a large telephone directory with about 500 names and under each
> name I have max 8 phones which are in seperate columns. When I run a
> search, I have to go column by column like mysql_query("select * from
> phones where phone1 like '274%')"); and etc. Is there a way to make a
> better search so that I can make this search faster and not repeating
> itself again and again?
One thing to consider (if you're not so far into things already that it
isn't feasible) might be breaking the phone numbers out into a separate
table (one phone number per row, along with whatever other information is
relevant, and a pointer back to the directory entry).
If that's not an option, you could at least consolidate all your repetitions
into one query (select * from phones where phone1 like '274%' or phone2 like
'274%' or phone3 like '274%'...)
---
Mark Roedel | "Blessed is he who has learned to laugh
Systems Programmer | at himself, for he shall never cease
LeTourneau University | to be entertained."
Longview, Texas, USA | -- John Powell