title: Unable to insert into two different tables with help of transactions
body: <p>Below is a my code write up in which i am trying to insert data into two different tables with help of transactions but code is not executing. Trying very hard to find out issue but unable to resolve it. </p>
  
  <p>I am getting this error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''u_id_fk','device_type','ip_num','package','pkg_id_fk') VALUES('79','abc','128.1' at line 1[]</p>
  
  <pre><code>                $cust_name = 'multi';
                  $u_name = 'multi2';
                  $cnic_num = '421';
                  $address = 'sadaddd';
                  $password = md5('423423'); 
                  $cellnum='43243';
                  $p_id_fk=(int)'3';
  
  
  
                      try {
                              // First of all, let's begin a transaction
                              $conn-&gt;beginTransaction();
                              // If we arrive here, it means that no exception was thrown
                              // i.e. no query has failed, and we can commit the transaction
                               // Forgot to close the VALUES bracket and couldn't find your $email
                              $users_stmt=$conn-&gt;prepare("INSERT INTO users (`cust_name`, `u_name`, `cnic`, `address`, `password`, `email`) VALUES (:cust_name, :u_name, :cnic, :address, :password, :email)");
                              // PDO::execute() can accept an array of parameter bound to your query so you may avoid selecting data type when using bindParam()
                             $users_stmt-&gt;execute(["cust_name"=&gt;$cust_name, "u_name"=&gt;$u_name, "cnic"=&gt;$cnic_num, "address"=&gt;$address, "password"=&gt;$password, "email"=&gt;$email]);
                              // Not sure if $db is a PDO object...
                              $connections_stmt=$conn-&gt;prepare("INSERT INTO connections('u_id_fk','device_type','ip_num','package','pkg_id_fk') VALUES(:u_id_fk,:device_type,:ip_num,:package,:pkg_id_fk)");
                              $connections_stmt-&gt;execute(["u_id_fk"=&gt;$u_id,"device_type"=&gt;$device_type,"ip_num"=&gt;$ip_num,"package"=&gt;$package,"pkg_id_fk"=&gt;$p_id_fk]);
  
  
                              $conn-&gt;commit();
                          } catch (Exception $e) 
                          {
                              // An exception has been thrown
                              // We must rollback the transaction
                              $conn-&gt;rollback();
                              echo $e;
                          }   
  </code></pre>
  
  <p>Please help to resolve it! Thanks </p>