Skip to content

Instantly share code, notes, and snippets.

@tonysm
Created March 30, 2012 00:53
Show Gist options
  • Save tonysm/2245422 to your computer and use it in GitHub Desktop.
Save tonysm/2245422 to your computer and use it in GitHub Desktop.
last error - database validation
<?php
class AppModel extends Model {
public function retornaErro(){
$db = ConnectionManager::getDataSource('default');
return $db->lastError();
}
}
<?php
class UsuariosController extends AppController {
public function add(){
$usuario = array(
'nome' => 'luiz'
);
if(!$this->Usuario->save($usuario)){
print_r($this->Usuario->retornaErro());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment