1

I have been taking a look, for if there any way to create a Zend_Db_Table_Select or Zend_Db_Select instance with a literal sql query. I mean, I've got a complex query and I want through this query create an object of that one. I have been reading the docs for this classes and I didn't find anything. I guess that this is not possible.

Do you know something about it?

Thank you very much.

1 Answer 1

1

I think your best bet would be to write this in your model:

public function customQuery ($table, $id) {
    return $this
        ->getDefaultAdapter()
        ->query("SELECT * FROM ? WHERE id = ?",
            array($table,$id)
        )
        ->fetchAll()
    ;
}

and also one more link would be very useful to you

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

1 Comment

Thank you very much, interesting way. I'm going to try it

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.