Skip to main content
removed "Drupal" from the title; removed tags from the title
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

How todo I update multiple rows in one db_query drupal 7single function call?

I want to update multiple rows in one query  , for example like this:as with the following code.

db_query("update bestsellers set count = 4 where product_id = 30;update30; update bestsellers set count = 5 where product_id = 32;update32; update bestsellers set count = 1 where product_id = 34;")->execute();

ButThe server returns a 500 error. I think it doesn't work , server can't process .Is there any way to achieve this?

How to update multiple rows in one db_query drupal 7?

I want to update multiple rows in one query  , for example like this:

db_query("update bestsellers set count = 4 where product_id = 30;update bestsellers set count = 5 where product_id = 32;update bestsellers set count = 1 where product_id = 34;")->execute();

But server returns 500 error. I think it doesn't work , server can't process .

How do I update multiple rows in one single function call?

I want to update multiple rows in one query, for example as with the following code.

db_query("update bestsellers set count = 4 where product_id = 30; update bestsellers set count = 5 where product_id = 32; update bestsellers set count = 1 where product_id = 34;")->execute();

The server returns a 500 error. Is there any way to achieve this?

Post Migrated Here from stackoverflow.com (revisions)
Source Link
Maxam
  • 133
  • 3

How to update multiple rows in one db_query drupal 7?

I want to update multiple rows in one query , for example like this:

db_query("update bestsellers set count = 4 where product_id = 30;update bestsellers set count = 5 where product_id = 32;update bestsellers set count = 1 where product_id = 34;")->execute();

But server returns 500 error. I think it doesn't work , server can't process .