Search code examples
phpyii2yii2-basic-app

Retrieve values from database table in yii2-app-basic


I'm not getting how to retrieve "id" from this query.

$post = Yii::$app->request->post('Users');
$params = [':UserMailID' => $post['email']];

$ResendCommand=Yii::$app->db->createCommand("SELECT * FROM users WHERE email=:UserMailID")
                            ->bindValues($params)->queryOne();

I want 'id' from this query. 'id' is one column of USERS table. Any Idea.


Solution

  • For getting id you use this syntax,

    <?php
    
    echo $ResendCommand['id'];
    
    ?>