所以我想要在我的PHP頁面上查看頁面,並使用Google搜索這個...我不想爲它創建一個新的數據庫,所以我在我的數據庫中發現了一個可用的位置(所以不能使用任何解決方案需要在數據庫中有超過1個單元格。SQL頁面查看Php
我得到了這個代碼來計數訪問,以便部分工作正常,但我似乎不能讓視圖的數量顯示(打印我猜它是正確的字)
<?php //Adds one to the counter
mysql_query("UPDATE news SET post = post + 1, published=published, last_edit=last_edit WHERE id=$id");
//Retreives the current count
$count1 = mysql_fetch_row(mysql_query("SELECT post FROM post"));
// Displays the count on your site print
echo $count1; ?>
任何想法,爲什麼我不會得到的結果顯示?
此外,在第一個查詢您更新的是'news'表,但在第二個你是從嘗試'POST'表 – redelschaap 2014-12-07 10:39:02
選擇改爲:select post from news but still nothing – Milla 2014-12-07 11:02:47
嘗試在'mysql_fetch_row()'行之後'var_dump($ count1)'並查看其中的內容 – redelschaap 2014-12-07 11:11:10