本文整理匯總了PHP中MyDB::num_rows方法的典型用法代碼示例。如果您正苦於以下問題:PHP MyDB::num_rows方法的具體用法?PHP MyDB::num_rows怎麽用?PHP MyDB::num_rows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MyDB
的用法示例。
在下文中一共展示了MyDB::num_rows方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: explode
include_once '../DB/MyDB.class.php';
$pageSize = $_GET["pagesize"];
$category = $_GET['category'];
if ($category == 0 || $category == 1001 || $category == 1002) {
$major_category = -1;
} else {
$major_category = $_GET['majorCategory'];
}
$date = $_GET['dt'];
$dateArr = explode("-", $date);
if (checkdate($dateArr[1], $dateArr[2], $dateArr[0]) == false) {
return false;
}
$thisdate = mktime(0, 0, 0, $dateArr[1], $dateArr[2], $dateArr[0]);
$nextdate = $thisdate + 3600 * 24;
$sql = "select talkid,count(*) as msgcount from allmsg where ";
if ($category == 0 || $category == 1001 || $category == 1002) {
$sql .= " channel = {$category}";
} else {
$sql .= " channel = 0 and postcategoryid={$category} ";
}
if ($major_category !== NULL && $major_category != -1) {
$sql .= " and postmajorcategoryid={$major_category} ";
}
$sql .= " and updatetime >= {$thisdate} and updatetime < {$nextdate} group by talkid order by msgcount desc";
$db = new MyDB();
$res = $db->query($sql);
$total = $db->num_rows($res);
$pageNums = ceil($total / $pageSize);
$db->close();
echo $pageNums;