I
I
Islamfon2015-10-09 16:35:15
MySQL
Islamfon, 2015-10-09 16:35:15

How to make 1 out of 2 MYSQL (PDO) queries?

Here are the requests

$get= DB::$the->query("SELECT request FROM `statistic` WHERE `id` = '1' ");
$get= $get->fetch(PDO::FETCH_ASSOC);

DB::$the->prepare("UPDATE statistic SET request=? WHERE id=? ")->execute(array($get['request']+1, '1'));

Please do not offer a similar query on pure mysql
update statistic set request = request + 1 where id = 1

I know it myself
I need it all on PDO

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Entelis, 2015-10-09
@DmitriyEntelis

And who prevents PDO from making a request conditionally
As it will be atomic unlike your first variant.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question