title: Invalid parameter while inserting into database
body: <p>I have an insert function part of CRUD class, I faced a problem after an update installed on ubuntu:</p>
  <p>crud.php</p>
  <pre><code>public function insert($table, $fields = [])
  {
  
      $field  = implode('&quot;, &quot;', $fields);
      $field  = $this-&gt;strSafe($field); // protect against XSS
      $sql = 'INSERT INTO ' . $table . ' (' . implode(', ', array_keys($fields)) . ') VALUES (&quot;' . $field . '&quot;)';
  
      $this-&gt;sql  = $sql;
      return $this-&gt;sql;
  }
  </code></pre>
  <p>Function for bind:
  crud.php</p>
  <pre><code>public function bind($param, $value, $type = null)
  {
      if (is_null($type)) :
          switch (true):
              case is_int($value):
                  $type = PDO::PARAM_INT;
                  break;
              case is_bool($value):
                  $type = PDO::PARAM_BOOL;
                  break;
              case is_null($value):
                  $type = PDO::PARAM_NULL;
                  break;
              default:
                  $type = PDO::PARAM_STR;
          endswitch; // end switch (true):
      endif; // end if (is_null($type)):
  
      $value  = $this-&gt;strSafe($value); // protect value against XSS
      $this-&gt;stmt-&gt;bindParam($param, $value, $type); // line 179
  }
  </code></pre>
  <p>prepare function</p>
  <pre><code>public function prepare()
  {
      return $this-&gt;stmt = $this-&gt;dbh-&gt;prepare($this-&gt;sql);
  }
  </code></pre>
  <p>All the variables are correct using the below code for insert:</p>
  <p>register_check.php</p>
  <pre><code>$insertclient  = [
              'client_key' =&gt; $client_key,
              'client_tel' =&gt; $telephone,
              'client_email' =&gt; $email,
              'client_add_date' =&gt; $GMTTimeStamp,
          ];
  
          $inCus = $dbh-&gt;insert('clients', $insertclient);
          $dbh-&gt;prepare($inCus);
  
          foreach ($insertclient as $fvk =&gt; $fvv) :
              $dbh-&gt;bind(':' . $fvk, $fvv); // line 152
          endforeach;
  
          $dbh-&gt;execute();
  </code></pre>
  <p>Then I've got this error:</p>
  <pre><code>AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number in crud.php:179\nStack trace:\n#0 crud.php(179): PDOStatement-&gt;bindParam()\n#1 register_check.php(152): Database-&gt;bind()\n#2 check.php(67): require_once('...')\n#3 {main}\n  thrown in crud.php on line 179', referer: register.html
  </code></pre>