Create select and insert statements from a PHP associative array using multiple tables
$30-100 USD
Abgeschlossen
Veröffentlicht vor mehr als 17 Jahren
$30-100 USD
Bezahlt bei Lieferung
I have a table in a MySQL database that I need to populate from an array in PHP. The partial array is below these instructions. I'm not sure if what I need to have can be done in one SQL query or if it requires a PHP script and multiple SQL queries and inserts -- I'll leave this up to you the experts. Here is what needs to be pulled from the array and inserted into the database tables. 1) Populate the "category" table with the "category_X", "category_X_X", "category_X_X_X" branches of the array. The top level "category_X" must be inserted first and assigned parent_id of zero, then the second level "category_X_X" inserted along with it's parents id into the "category" table. Note: currently the "products" table is fully populated with all products along with the vendor_sku's. 2) Iterate through the array and whenever a vendor_sku is found, query the "category" table for the specific category name that this vendor_sku belongs to and return the categories id. At the same time, the vendor_sku must be queried from the "products" table and return its product id. Then insert the category id and the product id into the "prod_cat_link" table. Table structure and a partial array are attached. Thanks.
## Deliverables
1) Complete and fully-functional SQL query written to work with MySQL. Any php scripting code to process the array must also be provided and fully functional.
2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):
a) Deliverables must be provided to buyer for integration into existing web script.
b) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
## Platform
MySQL v3.23.58 or v4.1.20 (either are acceptable, but prefer the v3.23.58) PHP v4.1.x or later FreeBSD or Linux