php - Why is my code not retrieving the data in a graph? -
<?php session_start(); include "../../lib/mssql.connect.php"; $params = array($_post['year'], sha1($_post['month'])); $sql ="select count(*) totalguestbook_totalcount, month(guestbook_createddate) mth tbl_guestbook year(guestbook_createddate) ='2015' group month(guestbook_createddate)"; // run query $result = sqlsrv_query($conn, $sql, $params) while($row = sqlsrv_fetch_array( $result, sqlsrv_fetch_assoc)) { $dashboardresult[] = array('label' =>$row['guestbook_createddate'], 'values' =>$row['totalguestbook_totalcount']); } echo json_encode($dashboardresult); ?>
do not include $params
in query execution use:
$result = sqlsrv_query($conn, $sql);
instead of :
$result = sqlsrv_query($conn, $sql, $params)
Comments
Post a Comment