I started my studies recently and a question arose about accessing information for a method. I have an X.php file that has the following structure:
public function selectDB($sql,$params=null,$class=null){
$query=$this->connect()->prepare($sql);
$query->execute($params);
$total_q = $query->rowCount();
if(isset($class)){
$rs = $query->fetchAll(PDO::FETCH_CLASS,$class) or die(print_r($query->errorInfo(), true));
}else{
$rs = $query->fetchAll(PDO::FETCH_OBJ) or die(print_r($query->errorInfo(), true));
}
self::__destruct();
return $rs;
}
And I have a Y.php page that makes use of this function. How do I make the Y.php page display the value of the $total_q
variable?
Could someone please give me a light?