0

i am getting this output from database data

i am using codeigniter 3

Array
(
    [0] => stdClass Object
        (
            [umeta_id] => 72
            [user_id] => 4
            [meta_key] => nickname
            [meta_value] => John ALbert
        )

    [1] => stdClass Object
        (
            [umeta_id] => 73
            [user_id] => 4
            [meta_key] => first_name
            [meta_value] => John
        )

    [2] => stdClass Object
        (
            [umeta_id] => 74
            [user_id] => 4
            [meta_key] => last_name
            [meta_value] => Albert
        )
)

but can i get data like this

Array
(
  [nickname] => John ALbert
  [first_name] => John
  [last_name] => Albert
)

i want like this if anyone help me i would be thankful

1 Answer 1

1

It is possible to receive the result of SQL processing as an array type.

The source code below is included in the CodeIgniter manual.

$query = $this->db->query("YOUR QUERY");

if ($query->num_rows() > 0)
{
        $row = $query->row_array();

        echo $row['title'];
        echo $row['name'];
        echo $row['body'];
}

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

Comments

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.