J
J
Julia Kovalenko2016-08-22 14:29:15
PHP
Julia Kovalenko, 2016-08-22 14:29:15

How to insert several rows into the database in php through prepared queries?

There is a code:

$command = \Yii::$app->db->createCommand(
                            "INSERT DELAYED INTO table_name
                                (id, phone, title, name, price)
                             VALUES 
                                (:id, :phone, :title, :name, :price);");

        $command->bindValues([":id" => $id, 
            ":phone" => $phone, 
            ":title" => $title, 
            ":name" => $name, 
            ":price" => $price]);

        $command->query();

Is it possible to somehow insert several lines at once according to this principle?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2016-08-22
@miraage

Yii2
Yii1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question