I’m trying to populate an array with the input of my database column named “title” from a table called Titles.
So essentially I want to create an array like this:
$array = array("foo", "bar", "hello", "world");
Where foo is a title, bar is a title, etc. (Except the title comes from the database, not the array declaration).
I tried this code:
$titlelist = Titles::find()
->select(['title'])
->limit(1000)
->asArray()
->all();
But this code puts an array into the array $titlelist (instead of just the string "foo"), which is not what I want. (Or atleast this is what I think it does. My error message says array to string conversion).
Any thoughts on how I can get this done easily?