RE: [fw-general] FetchRow() problem

2007-07-23 Thread Bill Karwin
The fetchRow() function returns null if no row in the table matches the 
condition you specified.
You should check the return value of fetchRow() after you call it.
 
Another choice is to call fetchAll(), which returns a Rowset object even if it 
contains zero rows.
 
Regards,
Bill Karwin




From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of José de 
Menezes Soares Neto
Sent: Monday, July 23, 2007 11:12 AM
To: Zend Framework General
Subject: [fw-general] FetchRow() problem


Hi friends,

I tried to retrieve information from two tables with this:

$employees = new Employees();
$employees = $employees->fetchRow('emp_id='.$id);
$employees = $employees->toArray();
$employees = extract($employees);

$users = new Users();
$users = $users->fetchRow('use_id='.$id); 
$users = $users->toArray(); // <--- Line 685
$users = extract($users);

Where $id is the ID from the employee. But I get the following message: 

Fatal error: Call to a member function toArray() on a non-object in 
C:\www\was\application\controllers\EmployeesController.php on line 685

I used it a while ago and it worked nice, but now it stop working!!!
You could see that toArray(); works for employees but not for users... 

Could somebody help me please?

best regards,

José de Menezes





Re: [fw-general] FetchRow() problem

2007-07-23 Thread Paulo Nei

Hi,

What are the values from $id and $users before call to toArray() ?
Try to debug with this:

$users = new Users();
Zend_Debug::dump($id); <-
$users = $users->fetchRow('use_id='.$id);
Zend_Debug::dump($users); <
$users = $users->toArray(); // <--- Line 685

Probably the $id you are using is wrong (not in database) and fetchRow() 
is returning NULL.


Regards,
Paulo

José de Menezes Soares Neto escreveu:

Hi friends,

I tried to retrieve information from two tables with this:

$employees = new Employees();
$employees = $employees->fetchRow('emp_id='.$id);
$employees = $employees->toArray();
$employees = extract($employees);

$users = new Users();
$users = $users->fetchRow('use_id='.$id);
$users = $users->toArray(); // <--- Line 685
$users = extract($users);

Where $id is the ID from the employee. But I get the following message:

*Fatal error*: Call to a member function toArray() on a non-object in 
*C:\www\was\application\controllers\EmployeesController.php * on line *685


*I used it a while ago and it worked nice, but now it stop working!!!
You could see that toArray(); works for employees but not for users...

Could somebody help me please?

best regards,

José de Menezes



[fw-general] FetchRow() problem

2007-07-23 Thread José de Menezes Soares Neto

Hi friends,

I tried to retrieve information from two tables with this:

$employees = new Employees();
$employees = $employees->fetchRow('emp_id='.$id);
$employees = $employees->toArray();
$employees = extract($employees);

$users = new Users();
$users = $users->fetchRow('use_id='.$id);
$users = $users->toArray(); // <--- Line 685
$users = extract($users);

Where $id is the ID from the employee. But I get the following message:

*Fatal error*: Call to a member function toArray() on a non-object in *
C:\www\was\application\controllers\EmployeesController.php* on line *685

*I used it a while ago and it worked nice, but now it stop working!!!
You could see that toArray(); works for employees but not for users...

Could somebody help me please?

best regards,

José de Menezes