php - From Two Dimensional Array To One Dimensional Array? -


Hey, I'm using fuel PHP and I am doing this ...

 < Code> $ query = \ DB :: Choose ('Username') - & gt; From ('Users') - & gt; Execute () - & gt; As_array ();   

I'm getting the array as shown below.

  Array ([0] => Array ([username] = & gt; daGrevis) [1] = & Gt; array ([username] => whatever) [2] = & gt; Array ([user name] => foobar))   

It is definitely not what I want. Here is an example of "ideal array" for me:

  Array ([0] => Dagrevis [1] => whatever [2] => Fobar)   

How can I get an "ideal array"? Maybe I'm doing something wrong in the query ... if not ... how can I convert array # 1 to array # 2? Maybe using loops? Or does it have built-in function? I'm confused.

You can do it originally with fuel:

  $ Query = \ DB :: Choose ('Username') - & gt; From ('Users') - & gt; Execute () - & gt; As_array (null, 'username');   

This will do what you want.

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -