Hi
I am trying to get count based on the select query using prepare. But i am unable to get the count.
Please help to fix the issue.
PDO function
public function getDistictCountRows($filname,$tablen,$condition){
echo $sql = "select $filname FROM $this->db_name.$tablen where $condition" ;
$query = $this->conn->prepare($sql);
try {
$query->execute();
}catch(PDOException $e) {
die($e->getMessage());
}
echo $row_count = $query->rowCount();
}
code
$Users = new Users($db);
$query = $Users->getDistictRows('DISTINCT(SHUSER)','FQ64001','ORDER BY SHUSER ASC');
$i=1;
while($row_stream = $query->fetch(PDO::FETCH_ASSOC)) {
extract($row_stream);
$SHUSER1 = trim($SHUSER);
$c1 = "SHUSER='$SHUSER1' and SHYQ64YN = 'Y'";
$active_count = $Users->getDistictCountRows('*','FQ64001',$c1);