本文整理汇总了PHP中getResultNum函数的典型用法代码示例。如果您正苦于以下问题:PHP getResultNum函数的具体用法?PHP getResultNum怎么用?PHP getResultNum使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getResultNum函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getAdminByPage
function getAdminByPage($page, $pageSize = 2)
{
$sql = "select * from imooc_admin";
//得到所有记录的记录数,这里把$totalRows变成全局变量,是方便listAdmin在判断总记录数,并判断显示页码时调用
global $totalRows;
$totalRows = getResultNum($sql);
//$pageSize记录每页显示几条,
$pageSize = 2;
//得到总页码数,这里把$totalPage设为全局变量,是方便listAdmin.php的总页数调用显示
global $totalPage;
$totalPage = ceil($totalRows / $pageSize);
//设置当前默认页数,这里把$page设为全局变量,是方便page.func.php在获取当前页时调用
global $page;
//判断是否小于1,是否为空,或者不是数字,则都为$page都为1
if ($page < 1 || $page == null || !is_numeric($page)) {
$page = 1;
}
if ($page >= $totalPage) {
$page = $totalPage;
}
$offset = ($page - 1) * $pageSize;
$sql = "select id,username,email from imooc_admin limit {$offset},{$pageSize}";
$rows = fetchAll($sql);
return $rows;
}
开发者ID:juststart2015,项目名称:Electronic-commerce-system,代码行数:25,代码来源:admin.inc.php
示例2: getAdminByPage
function getAdminByPage($page, $pageSize = 2)
{
$sql = "select * from imooc_admin";
global $totalRows;
$totalRows = getResultNum($sql);
global $totalPage;
$totalPage = ceil($totalRows / $pageSize);
if ($page < 1 || $page == null || !is_numeric($page)) {
$page = 1;
}
if ($page >= $totalPage) {
$page = $totalPage;
}
$offset = ($page - 1) * $pageSize;
$sql = "select id,username,email from imooc_admin limit {$offset},{$pageSize}";
$rows = fetchAll($sql);
return $rows;
}
开发者ID:qiancs1101,项目名称:Recommend-Purchase,代码行数:18,代码来源:admin.inc.php
示例3: getAdminByPage
function getAdminByPage($pageSize = 2)
{
$sql = "select * from myshop_admin";
$totalRows = getResultNum($sql);
$pageSize = 2;
$totalPage = ceil($totalRows / $pageSize);
$page = $_REQUEST['page'] ? (int) $_REQUEST['page'] : 1;
if ($page < 1 || $page == null || !is_numeric($page)) {
$page = 1;
}
if ($page >= $totalPage) {
$page = $totalPage;
}
$offset = ($page - 1) * $pageSize;
$sql = "select id,username,email from myshop_admin limit {$offset},{$pageSize}";
$rows = fetchAll($sql);
return $rows;
}
开发者ID:xc1129,项目名称:myshop,代码行数:18,代码来源:admin.inc.php
示例4: getPostNumByUid
function getPostNumByUid($uid)
{
$sql = "select pid from zhx_post where uid={$uid}";
return getResultNum($sql);
}
开发者ID:hardihuang,项目名称:zihuaxiang,代码行数:5,代码来源:post.inc.php
示例5: fetchOne
$sql = "select head_photo from tuhao_info where user_id={$_SESSION['id']}";
$src = fetchOne($sql);
$headPhoto = "uploads/" . $src['head_photo'];
} elseif (autoLogin()) {
$sql = "select * from tuhao_user where auto_token='{$_COOKIE['autoToken']}'";
$data = fetchOne($sql);
$username = $data['username'];
$loginFlag = $data['id'];
$id = $data['id'];
} else {
$username = '';
$loginFlag = 0;
$id = 0;
}
$sql2 = "select * from tuhao_pro where username='{$username}' and is_send=1 and status =0";
$sentNum = getResultNum($sql2);
$sql3 = "select * from tuhao_comm where receiver_id={$id} and status = 0";
$mesNum = getResultNum($sql3);
$smarty->assign('username', $username);
//$smarty->assign('headPhoto',$headPhoto);
$smarty->assign('study', $study);
$smarty->assign('clothes', $clothes);
$smarty->assign('digital', $digital);
$smarty->assign('transportation', $transportation);
$smarty->assign('entertainment', $entertainment);
$smarty->assign('others', $others);
$smarty->assign('activity', $activity);
$smarty->assign('loginFlag', $loginFlag);
$smarty->assign('sentNum', $sentNum);
$smarty->assign('mesNum', $mesNum);
$smarty->display("issue.tpl");
开发者ID:JimmyVV,项目名称:TuhaoWeb,代码行数:31,代码来源:issue.php
示例6: more
function more($pageSize)
{
$sql = "select * from tuhao_pro where is_send=0 order by hot desc limit 12,100";
$numRows = getResultNum($sql);
//总页码数
$totalPage = ceil($numRows / $pageSize);
$page = isset($_GET['curPage']) ? (int) $_GET['curPage'] : 1;
if ($page < 1 || $page == null || !is_numeric($page)) {
$page = 1;
} elseif ($page >= $totalPage) {
$page = $totalPage;
}
//偏移量
$offset = ($page - 1) * $pageSize + 12;
$sql1 = "select * from tuhao_pro where is_send=0 order by hot desc limit {$offset},{$pageSize}";
$rows = fetchAll($sql1);
$goods = array();
foreach ($rows as $row) {
$sql2 = "select album_path from tuhao_album where pid={$row['id']}";
$sql3 = "select id from tuhao_user where username='{$row['username']}'";
$src = fetchOne($sql2);
$user_id = fetchOne($sql3);
$sql4 = "select college from tuhao_info where user_id={$user_id['id']}";
$college = fetchOne($sql4);
$row['src'] = "uploads/" . $src['album_path'];
$row['reg_time'] = $row['reg_time'];
$row['college'] = $college['college'];
$goods[] = $row;
}
$arr = array('mes' => '获取帖子成功', 'code' => 1, 'curPage' => $page, 'maxPage' => $totalPage, 'data' => $goods);
return json_encode($arr);
}
开发者ID:JimmyVV,项目名称:TuhaoWeb,代码行数:32,代码来源:product.inc.php
示例7: sending
}
$pageSize = 8;
$data = sending($id, $pageSize, '');
$goods = 3;
$username1 = fetchOne("select username from tuhao_user where id={$id}");
$sql1 = "select * from tuhao_pro where username='{$username1['username']}' and receiver is null order by reg_time desc ";
$numRows = getResultNum($sql1);
$totalPage = ceil($numRows / $pageSize);
$sql2 = "select * from tuhao_pro where username='{$username}' and is_send=1 and status =0";
$sentNum = getResultNum($sql2);
$sql3 = "select * from tuhao_comm where receiver_id={$id} and status = 0";
$mesNum = getResultNum($sql3);
$sql = "select user_id,college,head_photo,levell,score from tuhao_info where user_id={$id}";
$user = fetchOne($sql);
$sql4 = "select * from tuhao_pro where id={$user['user_id']} and status=1";
$user['sendNum'] = getResultNum($sql4);
$user['src'] = "uploads/" . $user['head_photo'];
$user['username'] = $username1['username'];
$smarty->assign('username', $username);
$smarty->assign('study', $study);
$smarty->assign('clothes', $clothes);
$smarty->assign('digital', $digital);
$smarty->assign('transportation', $transportation);
$smarty->assign('entertainment', $entertainment);
$smarty->assign('others', $others);
$smarty->assign('activity', $activity);
$smarty->assign('loginFlag', $loginFlag);
$smarty->assign('sentNum', $sentNum);
$smarty->assign('mesNum', $mesNum);
$smarty->assign('data', $data);
$smarty->assign('user', $user);
开发者ID:JimmyVV,项目名称:TuhaoWeb,代码行数:31,代码来源:guest.php
示例8: getResultNum
<?php
/**
* Created by PhpStorm.
* User: ning-pc
* Date: 15/8/16
* Time: 上午11:25
*/
require_once '../include.php';
$sql = "select * from imooc_admin";
$totleRows = getResultNum($sql);
$pageSize = 2;
$totalPage = ceil($totleRows / $pageSize);
$page = $_REQUEST['page'] ? $_REQUEST['page'] : 1;
if ($page < 1 || $page == null || !is_numeric($page)) {
$page = 1;
}
if ($page >= $totalPage) {
$page = $totalPage;
}
$offset = ($page - 1) * $pageSize;
$sql = "select * from imooc_admin limit {$offset}, {$pageSize}";
$rows = fetchAll($sql);
foreach ($rows as $key => $row) {
echo $row['id'] . '-----' . $row['username'];
echo "<br>";
}
echo showPage($page, $totalPage, "cid=5&pid=6");
function showPage($page, $totalPage, $where = null, $sep = " ")
{
$where = $where == null ? null : "&" . $where;
开发者ID:kevins1022,项目名称:shop,代码行数:31,代码来源:page.func.php
示例9: getResultNum
<?php
/**
* Created by PhpStorm.
* User: ning-pc
* Date: 15/8/16
* Time: 下午8:43
*/
require_once '../include.php';
$pageSize = 2;
$page = $_REQUEST['page'] ? $_REQUEST['page'] : 1;
if ($page < 1 || !is_numeric($page) || $page == null) {
$page = 1;
}
$sql = "select * from imooc_admin";
$total = getResultNum($sql);
$offSet = ($page - 1) * $pageSize;
if ($page > $totalPage) {
$page = $totalPage;
}
$totalPage = ceil($total / $pageSize);
//$sql = "select * from imooc_admin limit {$offSet}, {$pageSize}";
//$rows = fetchAll($sql);
//if($rows<$total){
// echo showPage($page, $totalPage);
//
//}
echo showPage($page, $totalPage);
die;
//$rows = getAllAdmin();
echo "<table>";
开发者ID:kevins1022,项目名称:shop,代码行数:31,代码来源:listAdmin.php
示例10: fetchOne
$sql_checkGuestInfo = "SELECT country,locality,administrative_area_level_1,gender,ethnicity,user_type,arrival\n FROM tg_guest_info as i\n JOIN tg_guest_request r ON r.guest_id = i.guest_id\n JOIN tg_user_login lo ON lo.user_id = i.guest_id\n where lo.user_id={$_SESSION['user_id']}";
$row_checkGuestInfo = fetchOne($sql_checkGuestInfo);
$country = $row_checkGuestInfo['country'];
$city = $row_checkGuestInfo['locality'];
$state = $row_checkGuestInfo['administrative_area_level_1'];
$gender = $row_checkGuestInfo['gender'];
$ethnicity = $row_checkGuestInfo['ethnicity'];
$arrival = $row_checkGuestInfo['arrival'];
$type = $row_checkGuestInfo['user_type'];
//Booking Guest logic
$sql_book = "SELECT * from tg_booking where host_id={$id} and guest_id={$_SESSION['user_id']} and who_book=1";
$book = getResultNum($sql_book);
$status = fetchOne($sql_book);
//Re-Booking logic
$sql_2 = "SELECT * from tg_booking where host_id={$id} and guest_id={$_SESSION['user_id']} and who_book=2";
$book_2 = getResultNum($sql_2);
$row_2 = fetchOne($sql_2);
?>
<!-- Page Content -->
<div class="container">
<!-- Page Heading/Breadcrumbs row -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header text-center" style="margin:0;">
<small>
<div class="row" id="rp-house-tit">
<h2><b><?php
echo $row_house['house_title'];
?>
开发者ID:win87,项目名称:homarget2,代码行数:31,代码来源:view-house.php
示例11: PHPMailer
require_once 'include.php';
require 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$id = $_REQUEST['house_id'];
$arr = $_POST;
$arrival = $arr['arrival'];
$depart = $arr['depart'];
$time = date("Y-m-d");
$guest_id = $_SESSION['user_id'];
@($sql_guest = "SELECT *\n FROM tg_guest_info as i\n JOIN tg_guest_request as r ON r.guest_id = i.guest_id\n JOIN tg_user_login l ON l.user_id = i.guest_id\n where i.guest_id={$_SESSION['user_id']}");
$row_guest = fetchOne($sql_guest);
@($sql_host = "SELECT first_name,email\n FROM tg_host_info as i\n JOIN tg_user_login l ON l.user_id = i.host_id\n where i.host_id = {$id}");
$row_host = fetchOne($sql_host);
//Guest booking logic
$sql_book = "SELECT * from tg_booking where host_id={$id} and guest_id={$guest_id}";
$row_num = getResultNum($sql_book);
$row = fetchOne($sql_book);
$status = $row['status'];
if ($row_num == 0) {
$sql = "INSERT INTO tg_booking (host_id,guest_id,who_book,book_time) VALUES ('{$id}','{$guest_id}','2','{$time}')";
mysql_query($sql);
} else {
if ($status == 2) {
$sql = "UPDATE tg_booking SET status=0, who_book=2 where guest_id={$_SESSION['user_id']} and host_id={$id}";
mysql_query($sql);
} else {
alertMes('You have booked the host family.', 'guest-reservation-list.php');
return false;
}
}
//mail content
开发者ID:win87,项目名称:homarget2,代码行数:31,代码来源:guest-book-mail.php
示例12: checkProfileSession
<?php
require_once 'include.php';
require_once 'header.php';
checkProfileSession();
$id = $_REQUEST['guest_id'];
@($sql = "SELECT *\n FROM tg_guest_request as r\n JOIN tg_guest_info i ON i.guest_id = r.guest_id\n JOIN tg_user_login l ON l.user_id = r.guest_id\n where r.guest_id={$id}");
$row = fetchOne($sql);
$sql_checkInfo = "SELECT country,locality,administrative_area_level_1,gender,ethnicity,user_type\n FROM tg_house_location as l\n JOIN tg_host_info i ON i.host_id = l.location_id\n JOIN tg_user_login lo ON lo.user_id = l.location_id\n JOIN tg_host_house h ON h.house_id = l.location_id\n where lo.user_id={$_SESSION['user_id']}";
$row_checkInfo = fetchOne($sql_checkInfo);
//Booking logic
$sql_book = "SELECT * from tg_booking where guest_id={$id} and host_id={$_SESSION['user_id']} and who_book=2";
$book = getResultNum($sql_book);
$status = fetchOne($sql_book);
$sql_1 = "SELECT * from tg_booking where guest_id={$id} and host_id={$_SESSION['user_id']} and who_book=1";
$book_1 = getResultNum($sql_1);
$row_1 = fetchOne($sql_1);
$country = $row_checkInfo['country'];
$city = $row_checkInfo['locality'];
$state = $row_checkInfo['administrative_area_level_1'];
$gender = $row_checkInfo['gender'];
$ethnicity = $row_checkInfo['ethnicity'];
$type = $row_checkInfo['user_type'];
?>
<!-- Page Content -->
<div class="container">
<!-- Page Heading/Breadcrumbs row -->
<div class="row">
<div class="col-lg-12">
开发者ID:win87,项目名称:homarget2,代码行数:31,代码来源:view-guest.php
示例13: goodsComm
function goodsComm($pro_id, $pageSize, $type)
{
$comm = array();
$sql = "select * from tuhao_comm where pro_id={$pro_id} and parent_id=0 order by reg_time desc";
$numRows = getResultNum($sql);
//总页码数
$totalPage = ceil($numRows / $pageSize);
$page = isset($_GET['curPage']) ? (int) $_GET['curPage'] : 1;
if ($page < 1 || $page == null || !is_numeric($page)) {
$page = 1;
} elseif ($page >= $totalPage) {
$page = $totalPage;
}
//偏移量
$offset = ($page - 1) * $pageSize;
$sql1 = "select * from tuhao_comm where pro_id={$pro_id} and parent_id=0 order by reg_time desc limit {$offset},{$pageSize}";
$rows = fetchAll($sql1);
$res = array();
foreach ($rows as $row) {
$sql1 = "select pro_name from tuhao_pro where id={$row['pro_id']}";
$sql2 = "select head_photo from tuhao_info where user_id={$row['sender_id']}";
$sql3 = "select username from tuhao_user where id={$row['sender_id']}";
$sql4 = "select username from tuhao_user where id={$row['receiver_id']}";
$sql5 = "select * from tuhao_comm where parent_id={$row['id']}";
$sender = fetchOne($sql3);
$receiver = fetchOne($sql4);
$proName = fetchOne($sql1);
$src = fetchOne($sql2);
$comments = fetchAll($sql5);
foreach ($comments as $comment) {
$sql6 = "select username from tuhao_user where id={$comment['sender_id']}";
$sql7 = "select username from tuhao_user where id={$comment['receiver_id']}";
$sql8 = "select head_photo from tuhao_info where user_id={$comment['sender_id']}";
$sender1 = fetchOne($sql6);
$receiver1 = fetchOne($sql7);
$src1 = fetchOne($sql8);
$comment['sender_author'] = $sender1['username'];
$comment['receiver_author'] = $receiver1['username'];
$comment['src'] = "uploads/" . $src1['head_photo'];
$comm[] = $comment;
}
$row['sender_author'] = $sender['username'];
$row['receiver_author'] = $receiver['username'];
$row['goods_name'] = $proName['pro_name'];
$row['src'] = "uploads/" . $src['head_photo'];
$row['comments'] = $comm;
$res[] = $row;
$comm = array();
}
if ($type == 'json') {
$arr = array('mes' => 'success', 'code' => 1, 'curPage' => $page, 'maxPage' => $totalPage, 'data' => $res);
return json_encode($arr);
} else {
$arr = $res;
return $arr;
}
}
开发者ID:JimmyVV,项目名称:TuhaoWeb,代码行数:57,代码来源:comment.inc.php
示例14: tuhaoChart
function tuhaoChart($offset, $num, $type = '')
{
if ($type == 'week' || $type == '') {
$sql = "select * from tuhao_info order by week_score desc,id limit {$offset},{$num}";
} else {
$sql = "select * from tuhao_info order by score desc,id limit {$offset},{$num}";
}
$users = fetchAll($sql);
foreach ($users as $user) {
$sql2 = "select username from tuhao_user where id={$user['user_id']}";
$username = fetchOne($sql2);
$user['head_photo'] = "uploads/" . $user['head_photo'];
$user['id'] = $user['user_id'];
$user['username'] = $username['username'];
$sql1 = "select * from tuhao_pro where username='{$username['username']}' and status=1";
$user['sendNum'] = getResultNum($sql1);
$sql2 = "select * from tuhao_pro where receiver='{$username['username']}' and status=1";
$user['receiveNum'] = getResultNum($sql2);
if ($type == 'week' || $type == '') {
$user['score'] = $user['week_score'];
}
$arr[] = $user;
}
if ($type == 'month' || $type == 'week') {
return json_encode($arr);
} else {
return $arr;
}
}
开发者ID:JimmyVV,项目名称:TuhaoWeb,代码行数:29,代码来源:user.inc.php
示例15: getResultNum
$goods = 1;
$sql1 = "select * from tuhao_pro where username='{$username}' and receiver is not null order by reg_time desc ";
$numRows = getResultNum($sql1);
$totalPage = ceil($numRows / $pageSize);
} elseif ($type == 'info') {
$data = receiveComm($id, $pageSize, '');
$goods = 0;
$sql1 = "select * from tuhao_comm where receiver_id={$id} order by reg_time desc";
$numRows = getResultNum($sql1);
$totalPage = ceil($numRows / $pageSize);
} elseif ($type == 'sending') {
$data = sending($id, $pageSize, '');
$goods = 3;
$username1 = fetchOne("select username from tuhao_user where id={$id}");
$sql1 = "select * from tuhao_pro where username='{$username}' and receiver is null order by reg_time desc ";
$numRows = getResultNum($sql1);
$totalPage = ceil($numRows / $pageSize);
}
$arr = array('status' => 1);
update("tuhao_pro", $arr, "username='{$username}' and is_send=1 and status =0");
$sql = "select user_id,college,head_photo,levell,score from tuhao_info where user_id={$id}";
$user = fetchOne($sql);
$sql1 = "select username from tuhao_user where id={$user['user_id']}";
$username1 = fetchOne($sql1);
$user['src'] = "uploads/" . $user['head_photo'];
$user['username'] = $username1['username'];
$smarty->assign('username', $username);
$smarty->assign('study', $study);
$smarty->assign('clothes', $clothes);
$smarty->assign('digital', $digital);
$smarty->assign('transportation', $transportation);
开发者ID:JimmyVV,项目名称:TuhaoWeb,代码行数:31,代码来源:personal.php
示例16: error_reporting
<?php
require_once '../include.php';
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
// !!! shutdown the reporting of notices and warnings!!!
checkLogined();
$order = $_REQUEST['order'] ? $_REQUEST['order'] : null;
$orderBy = $order ? "order by u." . $order : null;
$keywords = $_REQUEST['keywords'] ? $_REQUEST['keywords'] : null;
$where = $keywords ? "where u.username like '%{$keywords}%'" : null;
//得到数据库中所有用户
$sql = "select u.id,u.username,u.pId,u.cId,u.capacity,u.address,u.phone,u.uDesc,u.pubTime,p.province, c.city from biogas_user as u join biogas_prov p on u.pId=p.id join biogas_city c on u.cId=c.id {$where}";
$totalRows = getResultNum($sql);
$pageSize = 6;
$totalPage = ceil($totalRows / $pageSize);
$page = $_REQUEST['page'] ? (int) $_REQUEST['page'] : 1;
if ($page < 1 || $page == null || !is_numeric($page)) {
$page = 1;
}
if ($page > $totalPage) {
$page = $totalPage;
}
$offset = ($page - 1) * $pageSize;
$sql = "select u.id,u.username,u.pId,u.cId,u.capacity,u.address,u.phone,u.uDesc,u.pubTime,p.province, c.city from biogas_user as u join biogas_prov p on u.pId=p.id join biogas_city c on u.cId=c.id {$where} {$orderBy} limit {$offset},{$pageSize}";
$rows = fetchAll($sql);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>-.-</title>
开发者ID:BigeyeDestroyer,项目名称:biogas,代码行数:31,代码来源:listOut.php
示例17: getServicesByPage
function getServicesByPage($pageSize)
{
$sql = "select * from tg_host_services";
$totalRows = getResultNum($sql);
//it has to be set to GLOBAL!!
global $totalPage;
$totalPage = ceil($totalRows / $pageSize);
@($page = $_REQUEST['page'] ? (int) $_REQUEST['page'] : 1);
if ($page < 1 || $page == null || !is_numeric($page)) {
$page = 1;
}
if ($page >= $totalPage) {
$page = $totalPage;
}
$offset = ($page - 1) * $pageSize;
$sql = "select * from tg_host_services as c join tg_user_login l on c.services_id = l.user_id order by c.id desc limit {$offset},{$pageSize}";
$rows = fetchAll($sql);
return $rows;
}
开发者ID:win87,项目名称:homarget2,代码行数:19,代码来源:admin.inc.php
注:本文中的getResultNum函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论