Hi everyone!
I am learning Yii and I have a specific problem. I am sure that it has an easy solution.
I have done an sql query, specifically this one:
$query=Yii::app()->db->createCommand()
->select(‘url,fecha’)
->from(‘videos’)
->order(‘fecha DESC’)
->limit(3)
->queryAll();
var_dump($query);
The result of the query is the following:
array(2) { [0]=> array(2) { ["url"]=> string(41) "url of a video in youtube" ["fecha"]=> string(10) "2015-08-08" } [1]=> array(2) { ["url"]=> string(41) "another url of a video in youtube" ["fecha"]=> string(10) "2015-08-08" } }
The data are correct and the query Works perfectly, but I am interested in take the "url" field of every single register of the query.
How can I do that?
This way I can put an embed video of YouTube in my website, because the url tag will be taken of my database, and furthermore I can order this videos by the date field. I tried different things to get in a single variable the value of the url field of the return of the sql query, but I have not succeed yet.
¿Somebody knows how to do it?
Thanks!