Count Number Of Rows (Help)
| From: | Yuan N Yudistira | Date: | Wed, 01 Sep 2004 08:23:00 +0000 |
| Subject: | Count Number Of Rows (Help) | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14364@lists.php.net to get a copy of this message | ||
I create a Query :
$sQuery = " SELECT c.* , rt.* , rtc.*
FROM contract c , rate_type rt, rate_type_contract rtc
LEFT JOIN client cl ON c.client_id = cl.client_id
WHERE ";
$sQuery .=" c.contract_id = rtc.contract_id ";
$sQuery .=" AND rtc.rate_type_id = rt.rate_type_id ";
$sQuery .= " AND cl.organization_name LIKE
'%".$input->client->organization_name."%' ";
if($input->hasAllotment==1){
$sQuery .= " AND c.has_allotment = ". $input->hasAllotment;
}
if ($input->entity->entity_id != 0) $sQuery .= " AND c.entity_id
=".$input->entity->entity_id;
if($input->searchPeriod == 'current') {
$sQuery .=" AND c.validity_end > now() ";
}
if($input->searchPeriod == 'past') {
$sQuery .=" AND c.validity_end < now() ";
}
$sQuery .= $sOrder . $sLimit;
and pass it to an object
$oContract->query($sQuery);
How to find out and count number of rows of the search result,...
if
I can not use $oContract->count();
Please help.
Thanks
YUAN