title: problem with php + mysql ( field name "group" )
body: <pre><code>public function insert($table, $data = array()) {
      $fieldnames = array_keys ( $data );
      var_dump(implode ( ' ,', $fieldnames ));
      $name = '( ' . implode ( ' ,', $fieldnames ) . ' )';
      $value = '(:' . implode ( ', :', $fieldnames ) . ' )';
      $query = "INSERT INTO $table";
      $query .= $name . ' VALUES ' . $value;
      var_dump($query);
      $insert = $this-&gt;start-&gt;prepare ( $query );
      return $insert-&gt;execute ( $data );
  }
  </code></pre>
  
  <p><strong>Question: ok i have a function that helps me simplify the insert statement (pdo) the problem is is when i insert a field if "group" name on it</strong></p>
  
  <pre><code>$a['group'] = $_POST['group'];
  $a['tag'] = $_POST['tag'];
  $a['information'] = $_POST['information'];
  $status= $this-&gt;insert ( 'groups', $a);
  </code></pre>
  
  <p>it will generate a mysql error like </p>
  
  <blockquote>
    <p>PDOStatement::execute()
    [pdostatement.execute]:
    SQLSTATE[42000]: Syntax error or
    access violation: 1064 You have an
    error in your SQL syntax; check the
    manual that corresponds to your MySQL
    server version for the right syntax to
    use near 'group ,tag ,information )
    VALUES ('agroup', 'atag',
    'ainformation' )'</p>
  </blockquote>
  
  <p>this is the query</p>
  
  <pre><code>INSERT INTO groups( group ,tag ,information ) VALUES (:group, :tag, :information )
  </code></pre>
  
  <p>im guessing that it should be</p>
  
  <pre><code>INSERT INTO groups( "group" ,"tag" ,"information" ) VALUES (:group, :tag, :information )
  </code></pre>
  
  <p>im not sure where should we start from.</p>
  
  <p>Thanks for looking in</p>
  
  <p>Adam Ramadhan</p>