0

I have an array(1) { [0]=> array(1) { ["id"]=> string(1) "2" } }

How could break it down to a string as I am only getting one value?

Model:

$table = $this->_table_products_manufacturers;
        $query  = $this->db->query("SELECT $table.id FROM $table WHERE $table.id = $manufacturer_id");

        return $query->result_array();

1 Answer 1

1

Something like:

$table = $this->_table_products_manufacturers;
$query = $this->db->query("SELECT $table.id FROM $table WHERE $table.id = $manufacturer_id");
$result = $query->result_array();
return $result[0]['id'];

Will it help?

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

2 Comments

THANK YOU didnt think of it like that
If this replies your query, please accept this as "answer". Thank you :)

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.