Skip to content

Instantly share code, notes, and snippets.

@coudenysj
Created March 5, 2013 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coudenysj/5089198 to your computer and use it in GitHub Desktop.
Save coudenysj/5089198 to your computer and use it in GitHub Desktop.
A small snippet that uses Zend\Db, but should create bind placeholder in the $query->where() instead of injecting the actual value.
<?php
$sql = new \Zend\Db\Sql\Sql($db, 'user');
$query = $sql->update();
$query->set(array('_update' => date('Y-m-d H:i:s')));
$query->where(array('userID' => 1));
$stmt = $sql->prepareStatementForSqlObject($query);
$stmt->execute(array('userID' => 1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment