What i want:
Array
(
[0] => Array
(
[id] => 154
[url] => http://farm9.staticflickr.com/8187/8105302152_c886bc2179_c.jpg
[categorie_id] => 2
[user_id] => 23
[time] => 2012-10-20 18:13:40
)
)
What i have:
Array
(
[id] => 158
[url] => http://farm9.staticflickr.com/8468/8105709759_915c1092b4_c.jpg
[categorie_id] => 2
[user_id] => 23
[time] => 2012-10-20 19:30:16
)
(don’t mind about the values, they are different and i know that)
Actually quite a simple question, but i just can’t find it how to solve it.
Both arrays are associative fetched (this is a return of database).
In the above example there are multiple records (pictures) so it returns a 0,1,2,3, … and in there the data. When i only have 1 picture in my database i get errors, because i don’t have the numeral key (‘0’) in that array. So i want to add the ‘0’ key.
You can do this
or