0

当我将此代码放在 ProcessMaker 上的触发器中时,我想将我在我的网格中的数据插入到我的数据库中的表“报价”中。当我尝试使用正常形式时,它可以工作,但是如果网格可以工作,我认为这是语法问题或 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');
}
4

1 回答 1

0

您的代码看起来不错,您可能想要做的 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);
于 2014-10-12T05:45:01.427 回答