New Zenner
- Join Date:
- Mar 2008
- Posts:
- 1
- Plugin Contributions:
- 0
Use PHP to compare fields from two different tables in same database and yield result
I have installed the contribution Drop Ship / Supplier Interface to Zen Cart where a seller logs in and can add product. As usual the seller logs in with an email and password which is stored in the mysql table _SUPPLIER_ADMINS. This table also contains the field supplier_admin_name.
When the seller adds product they currently have the choice to select a manufacturer. For later reporting reasons (in Sales Report 2.0) I am attempting to change the default manufacture depending on the seller logged in. The manufacturer is stored in the mysql table MANUFACTURES. It should be noted this same table also contains manufactuer_id and manufacture_name. I have created product manufactures in the cart that match each sellers_admin name.
It should also be noted that Zen Cart uses the manufactuer_id to select, store, display and report on information not the manufacture_name.
As stated I am attempting to create code that will change the default manufacturer based on the seller that is logged in. Both of the fields that I want to compare are VARCHAR(32). I am not sure if this matters but one is of collation latin1_swedish_ci and the other is utf8_general_ci.
I want the code to do the following:
If the supplier_admin_name from table _SUPPLIER_ADMINS is equal to manufacture_name from table _MANUFACTURES then the default manufacturer will be equal to the corresponding manufactuer_id. Corresponding meaning from the same record as the matching manufacture_name.
I know very little about PHP any help with this code would be appreciated.
Thanks in advance,
dbanrman
[email protected]