T
T
Trustlab2015-10-12 20:03:16
PHP
Trustlab, 2015-10-12 20:03:16

How to form 1000 queries to mysql?

Hi all.
You need to update the titles of 1000 products on the site.
Doing it manually is hemorrhoids.
Decided through the database, queries.
So what is there.
1. SQL query.
UPDATE category_description set title = 'new title' where h1 = 'title text to recognize'
2. There is an array of data in excel.
column A - title to recognize the product in the database
Column B - new title
Now we need to substitute the values ​​from the columns in Excel and make 1000 different queries to the database.
I'm not strong in php, maybe there is a simple script for such substitutions?
Or some function in excel.
I will be grateful to everyone for the answers.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Kovalsky, 2015-10-12
@Trustlab

you do not need 1000 requests, but one and quite the simplest. if you have an excel file, then convert it to csv, load it into a temporary table and update by joining the table to update and this temporary

A
Alexey Skobkin, 2015-10-12
@skobkin

Take export the file to CSV. Then, using fgetcsv() , iterate through the list of entries and substitute parameters in a pre- prepared query .

C
Curly Brace, 2015-10-12
@stasuss

try dbforge
maybe in mysql workbench there is something similar xs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question