0

The usage of the select_array():

$value = array( 'username', 'email', 'firstname' );

$result = DB::select_array( $value ) ->from( 'user' ) ->where( 'userid', '=', '1' ) ->execute() ->as_array();

print_r( $result[0] );
4
  • 2
    Nice. Now, could you ask your question? Commented Aug 27, 2013 at 5:22
  • How can use alias in select_array()? Commented Aug 27, 2013 at 5:34
  • if you want to ask like The usage of select_array() in Query builder? then it means the name of fields that you want fetch from the query, and it is good practice to fetch the necessary field instead of all the fields. Commented Aug 27, 2013 at 5:34
  • Thanks. but i need all fields with other name. And the query value will passing in the controller itself. I need some suggestion. Commented Aug 27, 2013 at 5:37

1 Answer 1

1

Try with this might be it helps you.

$value = array( 
              array('username', 'uname'), 
              array('email', 'mail'), 
              array('firstname', 'fname') 
         );

DB::select_array( $value ) 
        ->from( 'user' ) 
        ->where( 'userid', '=', '1' ) 
        ->execute() 
        ->as_array();

take a look on select_array

Sign up to request clarification or add additional context in comments.

1 Comment

and we can try this one also. $value = array( 'username' =>array('username', 'uname'), 'email' => array('email', 'mail'), 'firstname' => array('firstname', 'fname') );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.