I am not sure where your problem is in the php code. However if you think the 
date is the issue use timestamps which are basically numbers. I did that 
successfully in the past. On the flex side you can write an utility for 
translating that into a date for display purposes. 

Which line is 61 in your code anyway ?

C




________________________________
From: Stephen <sd_br...@ntlworld.com>
To: flexcoders@yahoogroups.com
Sent: Fri, August 27, 2010 12:27:57 AM
Subject: [flexcoders] Flex PHP Service with Date Parameters Help

   
I'm having some trouble using the Date as a Parameter does anybody know where 
I'm going wrong as I am currently getting the error: 

Reason: 
Fatal error: Call to a member function toString() on a non-object in 
C:\wamp\www\testing-debug\services\TestingService.php on line 61
mysqli_stmt_bind_param($stmt, 'ss', $from->toString('YYYY-MM-dd'), 
$to->toString('YYYY-MM-dd'));

public function getAllTestingByRange($from, $to) {

$stmt = mysqli_prepare($this->connection, "SELECT name_no, SUM(amount) AS total 
FROM $this->tablename WHERE datefield BETWEEN ? AND ? GROUP BY name_no"); 

$this->throwExceptionOnError();

mysqli_stmt_bind_param($stmt, 'ss', $from->toString('YYYY-MM-dd'), 
$to->toString('YYYY-MM-dd')); 

$this->throwExceptionOnError();

mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();

$rows = array();

mysqli_stmt_bind_result($stmt, $row->name_no, $row->total);

while (mysqli_stmt_fetch($stmt)) {
$rows[] = $row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt, $row->name_no, $row->total);
}

mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);

return $rows;
}


 


      

Reply via email to