Searching Multiple Columns, Multiple Tables in MySQL...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry if this is too DB oriented.

PHP 4.3, MySQL 3.23

I've got a somewhat complex search of a MySQL database I'm trying to make.
(At least it's complex to me.)  And I'm wondering if it's better to try to
handle it in MySQL or to split it up into multiple processes using PHP.

Essentially, I have three tables: vendors, products, and a join table for
vendors and products:

VENDORS
-------
vendorid INT
vendorname VARCHAR
vendorcategory VARCHAR

PRODUCTS
--------
productid INT
productname VARCHAR
productcategory VARCHAR

JOINS
-----
xid INT
xproductid INT
xvendorid INT

I want to be able to do a keyword search of sorts with a list of vendors as
the result.  However, I want one value from a form to be used to search
three columns in two different tables: vendorcategory, productname, and
productcategory.  Of course, the join table would have to be used to make
sure that the product names and categories that match give corresponding
vendors.

There's probably some method of using MySQL to do this with one query, but
it's beyond me.  And experience tells me that sometimes it's easier or
better to use PHP (or even necessary to use PHP) to get the results how I
want them, often splitting complex queries into two parts.

Any suggestions?

Thanks.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux