當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Pager::showTotal方法代碼示例

本文整理匯總了PHP中Pager::showTotal方法的典型用法代碼示例。如果您正苦於以下問題:PHP Pager::showTotal方法的具體用法?PHP Pager::showTotal怎麽用?PHP Pager::showTotal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Pager的用法示例。


在下文中一共展示了Pager::showTotal方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: responseList

function responseList($id)
{
    $myReturn = '';
    $sql = "select DateAdded, ResponseID from sm15_responses where SurveyID = {$id}";
    #reference images for pager
    $prev = '<img src="' . VIRTUAL_PATH . 'images/arrow_prev.gif" border="0" />';
    $next = '<img src="' . VIRTUAL_PATH . 'images/arrow_next.gif" border="0" />';
    # Create instance of new 'pager' class
    $myPager = new Pager(10, '', $prev, $next, '');
    $sql = $myPager->loadSQL($sql);
    #load SQL, add offset
    # connection comes first in mysqli (improved) function
    $result = mysqli_query(IDB::conn(), $sql) or die(trigger_error(mysqli_error(IDB::conn()), E_USER_ERROR));
    if (mysqli_num_rows($result) > 0) {
        #records exist - process
        if ($myPager->showTotal() == 1) {
            $itemz = "response";
        } else {
            $itemz = "responses";
        }
        //deal with plural
        $myReturn .= '<div align="center">We have ' . $myPager->showTotal() . ' ' . $itemz . '!</div>';
        while ($row = mysqli_fetch_assoc($result)) {
            # process each row
            $myReturn .= '<div align="center"><a href="' . VIRTUAL_PATH . 'surveys/response_view.php?id=' . (int) $row['ResponseID'] . '">' . dbOut($row['DateAdded']) . '</a>';
            $myReturn .= '</div>';
        }
        $myReturn .= $myPager->showNAV();
        # show paging nav, only if enough records
    } else {
        #no records
        $myReturn .= "<div align=center>There are currently no surveys</div>";
    }
    @mysqli_free_result($result);
    //$myReturn .= $id;
    return $myReturn;
}
開發者ID:kfenske,項目名稱:ITC-250,代碼行數:37,代碼來源:survey_view.php

示例2: Pager

?>
demo_list_pager.php">Muffins</a></p>
<p>Use <b>demo_list_pager.php</b> and <b>demo_view_pager.php</b> as a starting point for building your own List/View web application!</p> 
<?php 
#reference images for pager
$prev = '<img src="' . VIRTUAL_PATH . 'images/arrow_prev.gif" border="0" />';
$next = '<img src="' . VIRTUAL_PATH . 'images/arrow_next.gif" border="0" />';
# Create instance of new 'pager' class
$myPager = new Pager(10, '', $prev, $next, '');
$sql = $myPager->loadSQL($sql);
#load SQL, add offset
# connection comes first in mysqli (improved) function
$result = mysqli_query(IDB::conn(), $sql) or die(trigger_error(mysqli_error(IDB::conn()), E_USER_ERROR));
if (mysqli_num_rows($result) > 0) {
    #records exist - process
    if ($myPager->showTotal() == 1) {
        $itemz = "survey";
    } else {
        $itemz = "surveys";
    }
    //deal with plural
    echo '<div align="center">We have ' . $myPager->showTotal() . ' ' . $itemz . '!</div>';
    while ($row = mysqli_fetch_assoc($result)) {
        # process each row
        echo '<div align="center"><a href="' . VIRTUAL_PATH . 'surveys/survey_view.php?id=' . (int) $row['SurveyID'] . '">' . dbOut($row['Title']) . '</a>';
        echo '</div>';
    }
    echo $myPager->showNAV();
    # show paging nav, only if enough records
} else {
    #no records
開發者ID:sallytheo,項目名稱:itc250-sm15-surveys,代碼行數:31,代碼來源:index.php

示例3: mysqli

<?php 
#reference images for pager
$prev = '<img src="' . VIRTUAL_PATH . 'images/arrow_prev.gif" border="0" />';
$next = '<img src="' . VIRTUAL_PATH . 'images/arrow_next.gif" border="0" />';
#Create a connection
# connection comes first in mysqli (improved) function
$iConn = @mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die(myerror(__FILE__, __LINE__, mysqli_connect_error()));
# Create instance of new 'pager' class
$myPager = new Pager(3, '', $prev, $next, '');
$sql = $myPager->loadSQL($sql, $iConn);
#load SQL, pass in existing connection, add offset
$result = mysqli_query($iConn, $sql) or die(myerror(__FILE__, __LINE__, mysqli_error($iConn)));
if (mysqli_num_rows($result) > 0) {
    #records exist - process
    if ($myPager->showTotal() == 1) {
        $itemz = "workout";
    } else {
        $itemz = "workouts";
    }
    //deal with plural
    echo '<p align="center"><b>We have ' . $myPager->showTotal() . ' ' . $itemz . '!</b></p>';
    while ($row = mysqli_fetch_assoc($result)) {
        # process each row
        echo '<p align="center">';
        echo 'Workout Name: <b>' . $row['WorkoutName'] . '</b> ';
        echo 'Workout Type: <b>' . $row['WorkoutType'] . '</b> ';
        echo '<a href="' . VIRTUAL_PATH . 'workout_view.php?id=' . (int) $row['WorkoutID'] . '">' . dbOut($row['WorkoutName']) . '</a>';
        echo '</p>';
    }
    //the showNAV() method defaults to a div, which blows up in our design
開發者ID:tianagreisel,項目名稱:itc240-retrodiner,代碼行數:30,代碼來源:demo_list_pager2.php

示例4: Pager

$prev = '<img src="' . VIRTUAL_PATH . 'images/arrow_prev.gif" border="0" />';
$next = '<img src="' . VIRTUAL_PATH . 'images/arrow_next.gif" border="0" />';
$sql = "select * from petshop";
//We connect to the db here
$iConn = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
# Create instance of new 'pager' class
$myPager = new Pager(10, '', $prev, $next, '');
$sql = $myPager->loadSQL($sql, $iConn);
#load SQL, pass in existing connection, add offset
$result = mysqli_query($iConn, $sql) or die(myerror(__FILE__, __LINE__, mysqli_error($iConn)));
//We extract the data here
$result = mysqli_query($iConn, $sql);
if (mysqli_num_rows($result) > 0) {
    //show records, #records exist - process
    echo '<ul>';
    if ($myPager->showTotal() == 1) {
        $itemz = "pet";
    } else {
        $itemz = "pets";
    }
    //deal with plural
    while ($row = mysqli_fetch_assoc($result)) {
        # process each row
        echo '<li>';
        echo '<a href="pet_view.php?id=' . $row['id'] . '">';
        echo '<img class="my-thumnail" src="img/' . $row['img_path'] . '"/>';
        echo '<h2>' . $row['name'] . '</h2>';
        echo '</a></li>';
        /* echo '<p align="center">
           <a href="' . VIRTUAL_PATH . 'pet_view.php?id=' . (int)$row['CustomerID'] . '">' . dbOut($row['FirstName']) . '</a>
           </p>';*/
開發者ID:virgofreedom,項目名稱:petshop,代碼行數:31,代碼來源:pet_list.php


注:本文中的Pager::showTotal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。