Created
March 30, 2012 00:53
-
-
Save tonysm/2245422 to your computer and use it in GitHub Desktop.
last error - database validation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class AppModel extends Model { | |
public function retornaErro(){ | |
$db = ConnectionManager::getDataSource('default'); | |
return $db->lastError(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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