A
A
Albert Kazan2020-04-06 18:13:50
MySQL
Albert Kazan, 2020-04-06 18:13:50

How to make sql update better?

You need to do several hundred updates at a time in some rows in the table.

$views = 'какое то число';
$q = $pdo->prepare('UPDATE articles SET views=? WHERE id=?');
foreach ($rows AS $id) {
  $q->execute([$views, $id]);
}


Is this the only solution?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question