|
Posted by Nick Zukin on 10/04/06 11:10
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.
Navigation:
[Reply to this message]
|