Home PageArchiveContact UsAbout Us
If you are hopelessly addicted to drupal;
if bringing yourself to bed is allways a strugle;
if your main source of entertainement
is watching lullabot videos; then you belog
here.

How to INSERT data into multiple fields and rows in a single query

As I said before, the performance of your website can be greatly impacted by how many times you hit your database each time your PHP web page is been generated.

In this example we will show you how to write a MySQL query to insert several fields into several rows. It will al be done in a single MySQL Query.

The table and fields names that were used on this example are very familiar to Drupal developers.

INSERT IGNORE INTO node_revisions (title, body) VALUES
  ("This is the first title", "This is the first body"),
  ("This is the second title", "This is the second body");

No votes yet
MySQL