martes, 9 de agosto de 2016

Traer un registro de la base de datos

$user = \Yii::$app->db ->createCommand('SELECT * FROM user WHERE id= 1;')
->queryOne();
The queryOne() method returns an array of data for a single element. In the event that no data is found, this method will return false :
Array
(
[id] => 1
[email] => test@example.com
[password] => test123
[first_name] => test
[last_name] => user
[created_at] => 0
[updated_at] => 0
)

No hay comentarios:

Publicar un comentario