我想從數據庫中輸出從應用程序發送的總的短信。php mysql select語句;沒有得到輸出
這樣:date 2016-06-09 | total sent 4 | delivered 3 | failed 2|
| date | total_sent | delivered | failed |
+------------+------------+-----------+--------+
| 2016-06-09 | 4 | 3 | 1 |
+------------+------------+-----------+--------+
但是我在PHP代碼不起作用。有人請指引我...
$sql = mysql_query("SELECT DATE(time_sent) AS date,COUNT(*) as total_sent,SUM(status = 'Success') as delivered,SUM(status = 'failed') AS failed FROM smsdb GROUP BY DATE(time_sent) ");
$result1 = mysqli_query($con, $sql);
$resultarr = mysqli_fetch_assoc($result1);
$time_sent = $resultarr['time_sent'];
echo $time_sent;
http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php/14067623#14067623 – CD001
我編輯了這個問題。請看。 @ CD001 –
你試過在mysql應用程序中運行查詢嗎?例如,phpmyadmin –