Need php pdo implode arrays and insert multiple rows in mysql

六月ゝ 毕业季﹏ 提交于 2019-12-06 05:58:00
foreach ($_POST['date_day'] as $i => $date_day) {
    $insertQuery[] = '(?, ?)';
    $insertData[] = $_POST['amount'][$i];
    $insertData[] = $date_day;
}

Does it simply define/set that $insertQuery and $insertData both are arrays?

Yes.

And [] is a shorthand for array() since PHP 5.4, so you can make it

$insertQuery = [];
$insertData = [];

or

$insertQuery = array();
$insertData = [];

or

$insertQuery = $insertData = [];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!