Hi I am trying to display count of a row using function with get values. Please help me to fix the issue
class
class Users {
private $conn;
private $db_name= "DATABASE";
public function __construct($db)
{
$this->conn = $db;
}
/*Join Two Tables with where condition and order by*/
public function getJoinRows($tablen1,$tablen2,$where,$order_by){
$query = $this->conn->prepare("select * FROM $this->db_name.$tablen1,$this->db_name.$tablen2 where $where ORDER BY $order_by DESC");
try {
$query->execute();
return $query;
}catch(PDOException $e) {
die($e->getMessage());
}
}
/**/
public function transCount($tablen,$whereCondition)
{
$query = $this->conn->prepare("select count(*) from $this->db_name.$tablen where $whereCondition");
try{
$query->execute();
return $row_count = $query->fetchAll();
}catch(PDOException $e) {
die($e->getMessage());
}
}
}
Todisplay
$Users = new Users($db);
$query = $Users->getJoinRows('FQ64004 a','FQ64005 b','a.SSYQ64UKID=b.SSYQ64UKID','a.SSYQ64LRDT,a.SSYQ64TJBS');
$i=1;
while($row_stream = $query->fetch(PDO::FETCH_ASSOC)) {
extract($row_stream);
$Users = new Users($db);
$query = $Users->transCount('FQ64003','SEYQ64SID=$SSYQ64SID');
echo $count($query);
}