It returns NULL.
I'm completely puzzled by this. I've used framework 0.1.5 and it worked
fine, but 0.2.0 just fails on this.
When I store the $db element in the registry, then do this :
$db=Zend::registry('db');
$select=$db->select();
$select->from('Article','*')
->where('Artcile_id',$id);
$result=$db->fetchOne($select->__toString());
print_r($result);
The print_r returns '1', nothing more.
Dinh wrote:
>
> You may be need to check if $this->getAdapter() returns an expected
> object. var_dump() should be useful here.
>
> Dinh
>
> On 12/6/06, wimg <[EMAIL PROTECTED]> wrote:
>>
>> I've been setting up an app using Zend Framework 0.2.0.
>> I have a simple index.php, which :
>> - includes Zend.php
>> - sets autoloading for classes
>> - connects to MySQL database using PDO_MYSQL
>> - Does "Zend_Db_Table::setDefaultAdapter($db);"
>>
>> The IndexAction on the IndexController contains :
>> $inArticle = new Article();
>> $inArticle->getArticle(1);
>>
>> The Article.php in the models contains :
>>
>> class Article extends Zend_Db_Table
>> {
>> protected Article_id;
>> protected Article_name;
>>
>> public function getArticle($id)
>> {
>> $db=$this->getAdapter();
>> $where=$db->quoteInto('Article_id=?',$id);
>> $row=$db->fetchOne($where);
>> $this->Article_name=$row->Article_name;
>> }
>> }
>>
>>
>> When I run this example, I get :
>> Fatal error: Call to a member function quoteInto() on a non-object in ...
>>
>> Any idea what might be wrong here ? I've also tried it with 'find', but
>> that
>> gives the same error.
>>
>> I am extending Zend_Db_Table, so I thought I should be able to access the
>> functions quoteInto and find ?
>>
>> --
>> View this message in context:
>> http://www.nabble.com/inheritance-not-working---tf2768458s16154.html#a7720515
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>>
>
>
> --
> Nobody in nowhere
>
>
--
View this message in context:
http://www.nabble.com/inheritance-not-working---tf2768458s16154.html#a7721493
Sent from the Zend Framework mailing list archive at Nabble.com.