MySQL bulk INSERT or UPDATE

You can insert/update multiple rows using INSERT … ON DUPLICATE KEY UPDATE. The documentation has the following example: INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6) ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b); Or am I misunderstanding your question?

Sending mass email using PHP

First off, using the mail() function that comes with PHP is not an optimal solution. It is easily marked as spammed, and you need to set up header to ensure that you are sending HTML emails correctly. As for whether the code snippet will work, it would, but I doubt you will get HTML code … Read more

Bulk update mysql with where statement

The easiest solution in your case is to use ON DUPLICATE KEY UPDATE construction. It works really fast, and does the job in easy way. INSERT into `table` (id, fruit) VALUES (1, ‘apple’), (2, ‘orange’), (3, ‘peach’) ON DUPLICATE KEY UPDATE fruit = VALUES(fruit); or to use CASE construction UPDATE table SET column2 = (CASE … Read more

Bulk Update in C#

What I’ve done before is perform a bulk insert from the data into a temp table, and then use a command or stored procedure to update the data relating the temp table with the destination table. The temp table is an extra step, but you can have a performance gain with the bulk insert and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)