Jump to content

Search the Community

Showing results for tags 'simple pagination'.

  • 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 1 result

  1. Hi guys, thanks for all your help. I am trying to use php pagination without mysqli on one of my pages and I have the following php script. however, it keeps outputting an error that $page is not indexed please help and also how to put a css style attribute to my arrays. <?php $array = array('Music and chairs','hello mama','c','d','e','f','g','h','i','j'); //failing to put styles on this info array $total_data = count($array); // COUNTING TOTAL ARRAY $per_page = 3; // Outputting error on the $page below $page = intval($_GET['page']); // Error output is this - Undefined index: page if(empty($page) || $page==1) { $start_val = 0; $end_val = $per_page - 1; } else { $start_val = ($page * $per_page) - $per_page; $end_val = $start_val + ($per_page - 1); } //Echoing my array and failing to use my css for($i=$start_val;$i<=$end_val;$i++){ echo $array[$i].' '; } $less_than = $total_data/$per_page; if($less_than>intval($less_than)) $less_than = $less_than + 1; if($total_data>1) { echo '<div class="pagination">'; echo ($page-1)>0?'<a href="?page='.($page-1).'">Previous</a> ':'Previous '; for($i=1;$i<=$less_than;$i++){ if($page==$i) echo '<a class="paginator linkno">'; else echo '<a href="?page='.$i.'" class="paginator">'; echo $i; echo '</a> '; } echo ($page+1)<=$less_than?'<a href="?page='.($page+1).'">Next</a>':'Next'; echo '</div>'; } ?>
×
×
  • 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.