Hi, I am using
$result = mysqli_query($conn,"SELECT COUNT(*) FROM prod_catalogue WHERE cat_id ='".$catid."' " ) or die(mysqli_error($this->dblink));
How do i get the actual count from result because $result doesn't return a count.
$result will have a single row with count. You can assign the count a column name so it easy to reference it,
$query1 = mysqli_query($conn,"SELECT COUNT(*) AS mycount FROM prod_catalogue WHERE cat_id ='".$catid."' " ) or die(mysqli_error($this->dblink));
$res = mysqli_fetch_object($query1);
$count = $res->mycount;
1. Give an alias for count (*)
SELECT COUNT(*) as CNT FROM prod_catalogue WHERE cat_id .............
2. Then fetch the query result:
$ROW = mysqli_fetch_object($result);
3. Count will be the first element in the result set
$ROW->cnt:0