0

That is my array:

$rows = $this->fetchAll($a)->toArray();

How to push this exp. 'type' => 1 in all arrays in $rows?

1
  • can you be a little more clear in your question? Commented Aug 23, 2012 at 12:53

1 Answer 1

1

Either loop on each row of the result with a foreach and push the value on. This is pretty basic array manipulation you can find examples of all over the place.

Or, skip the loop in code a graft the type = 1 into the SELECT statement.

$this->select()
     ->from(array(
         't' => 'fooTable'
     ), array(
         'type' => new Zend_Db_Expr($db->quote('1')), 
         'id'   => 't.id'
         'col1'   => 't.someothercolumn'
         'col2'   => 't.someothercolumn2'
     )
);
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.