当我将此代码放入 ProcessMaker 上的触发器中时,我想将网格中的数据插入数据库表“quote”中。 当我尝试使用正常形式时,它有效,但如果网格有效,我认为这是语法问题,或者 foreach gridsizerows n 不是,有人可以帮助我吗: 这是代码
$i=0 foreach ($i < $gridsizerows) {
$i = i +1;
$id = @mygrid [$i]['id'];
$quantity = @mygrid[$i]['quantity'];
$pu = @mygrid[$i]['possible'];
$pt = @mygrid[$i]['pt'];
$to = @mygrid [$i]['designation'];
$sql = "INSERT INTO quotes (id, designation, quantity, pu, pt) VALUES ($id, $from, $pu, $pt, $amount)";
$tmp_db = executeQuery($sql, '90911865253a802b030e577077431812');
}
最佳答案
您的代码看起来不错,您可能想要做的 2 项可能的更改如下所示。
而不是这个:
$sql = "INSERT INTO quotes (id, designation, quantity, pu, pt) VALUES ($id, $from, $pu, $pt, $amount)";
使用这个:
$sql = "INSERT INTO quotes (id, designation, quantity, pu, pt) VALUES ('$id', '$from', '$pu', '$pt', '$amount')";
而不是这个:
$tmp_db = executeQuery($sql, '90911865253a802b030e577077431812');
使用这个:
$dbConn = '90911865253a802b030e577077431812';
$tmp_db = executeQuery($sql, $dbConn);
关于mysql - 需要从grid插入mysql数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24412428/