Jump to content

Search the Community

Showing results for tags 'paging'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. <div class="grid_12"> <div class="box first round fullpage mh500 grid"> <h2><?php echo $resource->_pageHead; ?></h2> <?php $resource->displayMessage(); ?> <?php if($resource->_recordCount > 0) { ?> <div class="block"> <table class="listing" > <thead> <tr> <th width="50" class="bdr-left">Sr. No.</th> <th width="60">Name</th> <th width="60">Email</th> <th width="60">Address</th> <th width="60">City</th> <th width="60">State</th> <th width="60">Phone Number</th> <th width="60">Country</th> <th width="60">Comment</th> <th width="60">Inquiry Date</th> <th width="60" class="bdr-right">Action</th> </tr> </thead> <tbody> <?php $i = 1; $_SESSION['number'] = $i; $perpage = 5; $q = mysql_query("SELECT * FROM $resource->_table"); $total_record = mysql_num_rows($q); $pages = ceil($total_record/$perpage); $page = (isset($_GET['page']))?$_GET['page']:1; $start = ($page-1) * $perpage; $result = mysql_query("SELECT * FROM $resource->_table LIMIT $start, $perpage"); while($res = mysql_fetch_array($result)) { ?> <tr class="odd gradeX"> <td><?php echo $i; ?></td> <td><?php echo $res['name']; ?></td> <td><?php echo $res['email'];?></td> <td><?php echo $res['address'];?></td> <td><?php echo $res['city'];?></td> <td><?php echo $res['state'];?></td> <td><?php echo $res['p_code']."-".$res['p_num'];?></td> <td><?php echo $res['country'];?></td> <td><?php echo substr($res['comments'], 0, 100);echo "...";?></td> <td><?php echo $res['inquiry_date'];?></td> <td align="center"> <a href="<?php echo $_SERVER['PHP_SELF'].'?action=delete&id='.$res['id'];?>" onclick="return confirm('Do you want to delete this record?');"> <img src="img/cross.png" alt="Delete" title="Delete"/> </a> </td> </tr> <?php $i++; } } ?> </tbody> </table> </div> <div id="paging" style="padding-left:500px;"> <?php $prev=$page-1; $next=$page+1; if($prev > 0) { echo "<a href='?page=$prev'>Prev</a>"; } echo " "; if($pages >= 1 AND $page <= $pages) { for($x=1;$x<=$pages;$x++) { echo " "; echo ($x==$page) ?"<a href=?page=$x style=\"font-weight:normal;\">$x</a>":'<a href="?page='.$x.'" >'.$x.'</a>'; } echo "&nbsp&nbsp"; if($page<$pages) { echo "<a href='?page=$next'>Next</a>"; } } ?> </div> </div> <div class="clear"></div> </div>
  2. I'm trying to add pagination but failing badly Here's my code: $query = "SELECT COUNT(*) FROM searchacts"; $pages = new Paginator; $pages->items_total = $num_rows[0]; $pages->mid_range = 9; $pages->paginate(); echo $pages->display_pages(); //### Initialize variables $pages = isset($_GET['page']) ? $_GET['page'] : FALSE ; $category = isset($_GET['categories']) ? $_GET['categories'] : FALSE ; $sort = isset($_GET['sort']) ? $_GET['sort'] : FALSE ; $upto = isset($_GET['upto']) ? $_GET['upto'] : FALSE ; //### Create the URL parameters $urlParameters = '?categories='. $category .'&upto='. $upto .'&sort='. $sort .'&page='. $pages .''; //### Start the query variable $query = 'SELECT * FROM `searchacts` $pages->limit'; //### Initialize query options $queryOptions = array(); //### Now check each of the sorting values //### Check which category we are searching in if($category == 'PopandRock') { $queryOptions[] = "`category` = 'Pop and Rock'"; } else if($category == 'SoulFunkDiscoMowtown') { $queryOptions[] = "`category` = 'Soul, Funk, Disco and Motown'"; } //### Check what value upto we are returning if($upto == '100') { $queryOptions[] = "`price` <= 100"; } else if($upto == '200') { $queryOptions[] = "`price` <= 200"; } else if($upto == '300') { $queryOptions[] = "`price` <= 300"; } //### Create final query $queryWhere = isset($queryOptions[0]) ? ' WHERE '.implode(' AND ', $queryOptions) : '' ; $finalQuery = $query . $queryWhere; //### Add the order by to the end of the query if($sort == 'PriceLow') { $finalQuery .= ' ORDER BY `price` ASC'; } else if($sort == 'PriceHigh') { $finalQuery .= ' ORDER BY `price` DESC'; } //echo $finalQuery; //echo '<br>'.$urlParameters; $result = mysql_query($finalQuery); $num = mysql_num_rows($result); and i've been trying to use this script/tutorial: http://net.tutsplus.com/tutorials/php/how-to-paginate-data-with-php/ so i've included the paginator.class.php, the $pages->limit on my select and tried to implement it into my url parameters Any Ideas? Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.