title: Update database row, else create a new row
body: <p>I am trying to use <code>REPLACE INTO</code> to update a row if it exists, and else it has to make a new row.</p>
  
  <p>I am using NOVA framework. Here is what i got:</p>
  
  <pre><code>public function updateTicketRows($id,$ticketId, $row, $stock, $price)
  {
      $pdo = DB::getPdo();
      return DB::raw('REPLACE INTO ticket_rows (id,ticket_id,row,stock,price)
                      VALUES('.$pdo-&gt;quote($id).','.$pdo-&gt;quote($ticketId).','.$pdo-&gt;quote($row).','.$pdo-&gt;quote($stock).','.$pdo-&gt;quote($price).')');
  }
  </code></pre>
  
  <p>It's called by:</p>
  
  <pre><code>foreach ($_POST['ticket'] as $ticket) {
                              $this-&gt;itemsModel-&gt;updateTicketRows($ticket['ticket_row_id'], $id,$ticket["ticket_row"],
                                  $ticket["ticket_stock"],$ticket["ticket_price"]);
                          }
  </code></pre>
  
  <p>However it just doesnt work. No new items are created and no items will be updated.</p>
  
  <p>Any one knows how i can do this?</p>
  
  <p>Thank you for the help in advance</p>