Creating a database for a single page

Permalink
I am having trouble insert items in a table from my single page controller.
It seems all the values are posting correctly.
But I get an "Access or Syntax" violation.
An exception occurred while executing 'INSERT INTO quickEvents (id, name, short, long, dates) VALUES (?, ?, ?, ?, ?)' with params [1, "empty", "empty", "empty", "empty"]: SQLSTATE[42000]: Syntax error or access violation: 1064 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 'long, dates) VALUES ('1', 'empty', 'empty', 'empty', 'empty')' at line 1

My code is simply:
public function new_event() {
    if ( $this->token->validate("new_event") ) {
      if ( Request::isPost() ) {
        $receive = array(
          'id','name','short','long','dates'
        );
        $data = array();
        foreach ( $receive as $key ) {
          $post = $this->post($key);
          !$post ? $post = 'empty' : $post = $post;
          $data[$key] = $post;
        }
        $db = Database::connection();
        $query = "INSERT INTO quickEvents (
        id,

It gets called by the single page form submit:
<form class="quick-events-add-event" method="post" action="<?=$this->action('new_event')?>">

ob7dev
 
ob7dev replied on at Permalink Reply
ob7dev
Just realized I needed to add a db.xml to my root package directory.
ob7dev replied on at Permalink Reply
ob7dev
Also would have helped if I wasn't using reserved mysql keywords for column names.