score:1

Accepted answer

I got the answer. I thought it is very difficult but its not.

This is my answer:

<?php
require_once('includes/database.php');
$stmt = mysqli_prepare($con, "SELECT date_format(entry_date, '%d-%b-%y'), 
sum(doc_count) as pAmount FROM report_details GROUP BY entry_date 
DESC");
$result = array('day' => array(), 'amount' => array());
if ($stmt) {
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $day, $amount);
while (mysqli_stmt_fetch($stmt)) {
  $result['day'][] = $day;
  $result['amount'][] = (int)$amount;
}
mysqli_stmt_close($stmt);
}
?>

I delete the alias 'pDate' and used the 'entry_date' to my query, and it works for me.


Related Query

More Query from same tag