Hi,
I am using a database class to perform standard calls to the database. Now I would like to use the mysql_calc_found_rows:
$pq = "select SQL_CALC_FOUND_ROWS * from "._PROGRAMMES_T_.$lnk['a1'].$lnk['a2'].$lnk['a3']." where ".$subq;
$res = $db->query($pq);
I am now unable to modify the class to have a function to return the rows found. Anybody able to give me a hand here?
The current query function for the class:
public function query($sql){
// do query
$this->query_id = @mysql_query($sql, $this->link_id);
if (!$this->query_id){
$this->oops("<b>MySQL Query fail:</b> $sql");
return 0;
}
$this->affected_rows = @mysql_affected_rows($this->link_id);
return $this->query_id;
}
I tried a new function:
public function show_rowcount() {
$this->rowcount = $this->query(SELECT FOUND_ROWS());
return $this->rowcount;
}
I get an error:
Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\degrees\includes\functions\general\databasesingleton_v1.php on line 180
[/cpde]
Line 180 is $this->rowcount = $this->query(SELECT FOUND_ROWS());
Am I going about this the wrong way?