Use PHP to compare fields from two different tables in same database and yield result

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dbanrman
    New Member
    • Mar 2008
    • 1

    Use PHP to compare fields from two different tables in same database and yield result

    I have a module in a shopping cart program where a sellers logs in and adds product. As usual the seller logs in with an email and password which is stored in the mysql table _supplier_admin s. 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 I am attempting to change the default manufacture depending on the seller logged in. The manufacturer is stored in the mysql table _manufactuers. It should be noted this same table also contains manufactuer_id and manufacture_nam e. I have created product manufactures in the cart that match each sellers_admin_ name.

    It should also be noted that the cart that I am using uses the manufactuer_id to select, store, display and report on information not the manufacture_nam e.
    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_admin sis equal to manufacture_nam e from table _manufactuers then the default manufacturer will be equal to the corresponding manufactuer_id. Corresponding meaning from the same record as the matching manufacture_nam e.

    I know very little about php and I am hoping to get help with this. I am using the Zen Cart shopping cart software. MySQL client version: 5.0.45 and PHP Version 5.25

    Any help with this code would be appreciated.

    Thanks in advance, dbanrman.
  • TheServant
    Recognized Expert Top Contributor
    • Feb 2008
    • 1168

    #2
    If you want help with some code you have, you're in the right place. If you want someone to write some code for you, you need to go somewhere else. Assuming you have some code already, post it here and then tell us why it's not working or particular questions.

    We don't make code, we fix code ;)

    [Edit]
    And use correct code tags in your post!
    Last edited by TheServant; Mar 26 '08, 04:22 AM. Reason: Always for get mentioning code tags...

    Comment

    Working...