I have a query
public static function TestQuery(
$start=0,
$limit=0){
$sql = "
SELECT count(*) AS total
FROM db.table1
JOIN db.table2
ON table1.fieldID = {$fieldID}
AND table2.assigned = 'N'";
$qry = new SQLQuery;
$qry->query($sql);
if($row = $qry->fetchRow()){
$total = intval($row->total);
}
return $total;
}
which works fine but when I add the limit as below, then it doesnt work and gives me errors
public static function TestQuery(
$start=0,
$limit=0){
$sql = "
SELECT count(*) AS total
FROM db.table1
JOIN db.table2
ON table1.fieldID = {$fieldID}
AND table2.assigned = 'N'";
//this fails
if($recordlimit > 0) $sql .= "LIMIT {$startRecord}, {$recordLimit} ";
//
$qry = new SQLQuery;
$qry->query($sql);
if($row = $qry->fetchRow()){
$total = intval($row->total);
}
return $total;
}
Any help will be appreciated