Note that there are some explanatory texts on larger screens.

plurals
  1. POexception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
    primarykey
    data
    text
    <p>Before reading: I know the table is too weird and long and it needs to be normalized; but for some reason this is my database and I should work with this table! Sorry about that! To keep it short: I'm getting the following exception:</p> <blockquote> <p>exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens' in C:\xampp\htdocs\FD\includes\helper.php:472 Stack trace:</p> <h1>0 C:\xampp\htdocs\FD\includes\helper.php(472): PDOStatement->execute(Array) #1</h1> <p>C:\xampp\htdocs\FD\newHrForm.php(113): helperFunctions::UpdateTableHrForms('112', 'dfsfdsfds', '3123213', 'dfdsf', '', '', '', '', '', '', '', '', '', '', '', '3213123213', '1', '3213123', '213123213', '3213213', '213123123', ) #2 {main}</p> </blockquote> <p>and my function to save data is as following:</p> <pre><code>public static function UpdateTableHrForms( $id,$dob_city,$dob_province,$dob_country,...) { $conn = new mysqlcon(); $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $query = "INSERT into `hr_forms` (`id`,`dob_city`, `dob_province`,`dob_country`,...) VALUES (:id,:dob_city,:dob_province,:dob_country,...)"; try { if (helperFunctions::CheckidExistForms($id) == 0) { $result = $conn-&gt;prepare($query); $result-&gt;execute(array('id'=&gt;$id,'dob_city'=&gt;$dob_city,'dob_province'=&gt;$dob_province,'dob_country'=&gt;$dob_country)); $Msg = "&lt;div style=\"text-align:center;\" class=\"alert alert-success\"&gt; &lt;strong&gt;Tips! &lt;/strong&gt; Data is successfully saved to database. &lt;button class=\"close\" data-dismiss=\"alert\" type=\"button\"&gt;&amp;times;&lt;/button&gt; &lt;/div&gt;"; } else { $Msg = "&lt;div style=\"text-align:center;\" class=\"alert alert-error\"&gt; &lt;strong&gt;Error! &lt;/strong&gt; This employee information is already existed in the system. &lt;button class=\"close\" data-dismiss=\"alert\" type=\"button\"&gt;&amp;times;&lt;/button&gt; &lt;/div&gt;"; } } catch (Exception $e) { $e-&gt;getMessage(); $Msg = $e; /* "&lt;div style=\"text-align:center;\" class=\"alert alert-error\"&gt; &lt;strong&gt;Error! &lt;/strong&gt; This employee information cannot save in the system. &lt;button class=\"close\" data-dismiss=\"alert\" type=\"button\"&gt;&amp;times;&lt;/button&gt; &lt;/div&gt;"; */ } return $Msg; } </code></pre> <p>When I replace the values of my insert method (in UpdateTableHrForms with the one that error gives me and run it in mysql; there is no error; but in PHP it is giving me the error; Could you please help me if I'm doing something wrong?)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload