0

I want to insert the data I have in my grid in table 'quote' in my database, when I put this code in the trigger on ProcessMaker. when I tried with a normal form it worked but if the grid it works I think it's a problem of syntax or foreach gridsizerows n is not, can someone please help me: here is the code

$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');
}
  • }////// $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 '); ///////// – user3770268 Jun 25 '14 at 15:10

1 Answers1

0

Your code looks good, 2 possible changes you might want to do are as given below..

Instead of this:

$sql = "INSERT INTO quotes (id, designation, quantity, pu, pt) VALUES ($id, $from, $pu, $pt, $amount)";

Use this:

$sql = "INSERT INTO quotes (id, designation, quantity, pu, pt) VALUES ('$id', '$from', '$pu', '$pt', '$amount')";

and Instead of this:

$tmp_db = executeQuery($sql, '90911865253a802b030e577077431812');

Use this:

$dbConn = '90911865253a802b030e577077431812';
$tmp_db = executeQuery($sql, $dbConn);
icedtrees
  • 6,134
  • 5
  • 25
  • 35
Ankit
  • 1
  • 1