我已經搜索了該問題,但無法找到它,我有一個腳本給了我這個警告警告:在/ home /在線52.php中劃分爲零可以看到http://usedcarsforsaleingauteng.com/的錯誤警告:在/ home/
如果你看下面,$ pages = ceil($ total/$ _GET [p]); //頁數是line 52.php
請問你們能幫忙嗎?謝謝
// get total number of entries for pagenation
$result = mysql_query("SELECT COUNT(*) FROM $dblist $where", $link);
$total = mysql_fetch_array($result); $total = $total[0]; // total number of listings
$pages = ceil($total/$_GET[p]); // number of pages
}
的'GET'參數'p'沒有設置。訪問該頁面時,您的網址是什麼樣的? – Kaii 2012-07-28 17:06:42
'$ _GET ['p']'將不會被定義,除非在查詢字符串中有一個名爲'p'的參數...所以你需要有一個默認的頁面長度,以防未設置。 – DCoder 2012-07-28 17:06:52
不意味着顯而易見...但是您是否檢查過以確保「$ _GET [p]」已被賦值爲非零值;)?什麼是「p」?我認爲你可能需要這樣的東西:if(isset($ _ GET ['p'])){$ pages = = ceil($ total/$ _GET ['p']); ...' – paulsm4 2012-07-28 17:07:07