Jump to content

Search the Community

Showing results for tags 'arithmetic logic'.

  • 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. Hey guys, i am trying to create some pagination within my page to allow a user to go through my entire catalog or data from my database. i have everything working correctly ( kinda ) , but for some reason when i then click on a link to get me around the pages, i get some problems. VARIABLES TO CREATE PAGINATION $per_page = 25; $page = (isset($_GET['page'])) ? (int) $_GET['page'] : 1; $start = ($page - 1 ) * $per_page; CONDITIONAL TO SEE WHERE THE USER IS AND WHAT TYPE OF INFO THEY WANT if(in_array($person_type,$all_links) === true) { // genre matches array of genres $query = "SELECT * FROM `content` WHERE `person_type` LIKE '%$type%' AND `is_type`=0 AND is_rating AND isdb_votes >10000 ORDER BY isdb_join_date DESC LIMIT $start , $per_page "; <--- this is where variables are being presented to track the position. //echo $query; } if (in_array($letter, $all_links) === true){ $query = "SELECT * FROM `content` WHERE `imdb_title` LIKE '$letter%' AND `is_type`=0 AND is_rating AND isdb_votes >10000 ORDER BY isdb_join_date DESC LIMIT $start , $per_page "; <--- this is where variables are being presented to track the position. //echo $query; } if (in_array($year, $all_links) === true) { $query = "SELECT * FROM `content` WHERE `imdb_release_date` LIKE '%$year%' AND `is_type`=0 AND is_rating AND isdb_votes >10000 ORDER BY isdb_join_date DESC LIMIT $start , $per_page "; <--- this is where variables are being presented to track the position.//echo $query; } THIS THEN QUERIES THE QUERY FROM WHICHEVER CONDITIONAL IS PASSED $links = mysql_query($query); DIV WHERE PAGINATION IS <div> <? $pages = ceil(mysql_result($links, 0) / $per_page); if ($pages >= 1) { for ($x = 1; $x<=$pages; $x++ ) { if (isset($_GET['genre']) === true) { echo '<a href = "browse.php?type='.$type.'&page='.$x.'">'.$x.' '; } else if (isset($_GET['letter']) === true) { echo '<a href = "browse.php?type='.$type.'&letter='.$letter.'&page='.$x.'">'.$x.' '; } else if (isset($_GET['year']) === true) { echo '<a href = "browse.php?type='.$type.'&year='.$year.'&page='.$x.'">'.$x.' '; } } } ?> </div> THE ISSUE: i get the links to show up and they all direct me to the correct query and connection to the Database. the first couple pages will work correctly, and there are no issues with the pagination. if you see above there is a variables called $pages = which spits out the number of pages total needed depending on how many items i want to be outputted. ( i.e 25 ). so one category would have 100 pages , one would have 300, and some even with say 10 pages. Now when i click on say page 10 of 100 that is being echoed the query fails. not only does the query fail , but the amount of pages numbers being outputted changes for the same directory. so category 1 with 100 pages then becomes category 1 with 67 pages. this makes no sense to me as to why this is happening. i also cant seem to understand also why i keep getting an error of to my understanding the query is no longer returning true , and now there are zero rows returning, yet if there was no more data to be given , why is there a page number being outputted in the first place ? any suggestions to this problem ? any help would be greatly appreciated.
×
×
  • 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.