martes, 9 de agosto de 2016

Traer varios registros de la base de datos

$users = \Yii::$app->db ->createCommand('SELECT * FROM user;')
->queryAll();
After running this command, our $users variable will be populated  with an array of users:
Array
(
[0] => 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