R
R
Roman Savitsky2017-07-13 15:51:35
Yii
Roman Savitsky, 2017-07-13 15:51:35

Insert into db 50,000 rows in Yii1?

Good afternoon!
In Yii2, you can write several rows to the database at once in this way:

$conditions .= "("."\"". $value[0]."\","."\"".$value[1]."\"), ";
$ResultSql_dannie = substr($conditions, 0, strlen($conditions) - 2);
Yii::$app->db->createCommand('INSERT INTO table_name (content,data_pablich) VALUES '.$ResultSql_dannie.'')->execute();

How to do it in Yii1 ? already tried a bunch of other options, only writes one line in this way
$sql = "INSERT INTO table_name (name, slug)  VALUES (:name, :slug)";
$parameters = array(":name"=>'Tester', ":slug"=>'[email protected]');

//Такой вариант не катит
//$parameters .= array(":name"=>'Tester', ":slug"=>'[email protected]');
//$parameters .= array(":name"=>'Tester', ":slug"=>'[email protected]');
Yii::app()->db->createCommand($sql)->execute($parameters );

Thanks in advance.

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