Jump to content

Search the Community

Showing results for tags 'paginationphp'.

  • 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. Ok im trying to achieve pagination through PHP on a ODBC query. I have used the pagination before on mysql database so I know it works. I have copied the code and changed it up so it match's the correct criteria for ODBC or mssql however its not working. Or should I say it is partly. Basically the buttons appear to move through the records and the total records returned counter seems to be working but the loop brings back no results. If i remove the pagination parts from the query and load the page the records are returned. This show me that the query is at least right but something in my pagination is killing it when I put it in. $currentPage = $_SERVER["PHP_SELF"]; $maxRows_rs_installs = 5;$pageNum_rs_installs = 0;if (isset($_GET['pageNum_rs_installs'])) { $pageNum_rs_installs = $_GET['pageNum_rs_installs'];}$startRow_rs_installs = $pageNum_rs_installs * $maxRows_rs_installs; $query_rs_installs = "SELECT allcalldataall.Call_Ref, allcalldataall.Call_Status_Description, allcalldataall.Date_Received, allcalldataall.Order_No, allcalldataall.Scheduled_Date_Time, allcalldataall.Link_to_Contract_Header, allcalldataall.Severity_Description, allcalldataall.repdonedate, Clients.Co_Name, Clients.Post_Code, LU_Call_Types.Type_Band, LU_Company_Types.Company_Type_DescriptionFROM { oj ((Siclops_Dispense.dbo.allcalldataall allcalldataall LEFT OUTER JOIN Siclops_Dispense.dbo.LU_Call_Types LU_Call_Types ON allcalldataall.Call_Type_Description = LU_Call_Types.Call_Type_Description) LEFT OUTER JOIN Siclops_Dispense.dbo.Clients Clients ON allcalldataall.Client_Ref = Clients.Client_Ref) LEFT OUTER JOIN Siclops_Dispense.dbo.LU_Company_Types LU_Company_Types ON Clients.Company_Type = LU_Company_Types.Company_Type_Code}WHERE allcalldataall.Call_Ref >= 710000 AND (allcalldataall.Call_Status_Description <> 'Reported Done' AND allcalldataall.Call_Status_Description <> 'PTF Rep Done' AND allcalldataall.Call_Status_Description <> 'Proforma Sent' AND allcalldataall.Call_Status_Description <> 'Paperwork Recvd' AND allcalldataall.Call_Status_Description <> 'Left On Site' AND allcalldataall.Call_Status_Description <> 'In Query' AND allcalldataall.Call_Status_Description <> 'Cryo PW Sent' AND allcalldataall.Call_Status_Description <> 'Complete' AND allcalldataall.Call_Status_Description <> 'Cancelled Admin' AND allcalldataall.Call_Status_Description <> 'Cancelled' AND allcalldataall.Call_Status_Description <> 'Awaiting Invoic' AND allcalldataall.Call_Status_Description <> 'Await TB Return' AND allcalldataall.Call_Status_Description <> 'ApplicationSent') AND (LU_Call_Types.Type_Band = 'Project' OR LU_Call_Types.Type_Band = 'Install') AND allcalldataall.Link_to_Contract_Header = '".$row_rs_member['companyident']."'ORDER BY allcalldataall.Call_Ref DESC"; //im thinking the problem might be occuring on the line below but im not sure$query_limit_rs_installs = sprintf("%s LIMIT %d, %d", $query_rs_installs, $startRow_rs_installs, $maxRows_rs_installs); $rs_installs = odbc_exec($conn, $query_limit_rs_installs);$row_rs_installs = odbc_fetch_array($rs_installs); if (isset($_GET['totalRows_rs_installs'])) { $totalRows_rs_installs = $_GET['totalRows_rs_installs'];} else { $all_rs_installs = odbc_exec($conn, $query_rs_installs); $totalRows_rs_installs = odbc_num_rows($all_rs_installs);}$totalPages_rs_installs = ceil($totalRows_rs_installs/$maxRows_rs_installs)-1; $queryString_rs_installs = "";if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_rs_installs") == false && stristr($param, "totalRows_rs_installs") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_rs_installs = "&" . htmlentities(implode("&", $newParams)); }}$queryString_rs_installs = sprintf("&totalRows_rs_installs=%d%s", $totalRows_rs_installs, $queryString_rs_installs); // then further down the page i have a loop which looks as follows //first the pagination <table border="0"> <tr> <td><?php if ($pageNum_rs_installs > 0) { ?> <a href="<?php printf("%s?pageNum_rs_installs=%d%s", $currentPage, 0, $queryString_rs_installs); ?>">First</a> <?php } ?></td> <td><?php if ($pageNum_rs_installs > 0) { ?> <a href="<?php printf("%s?pageNum_rs_installs=%d%s", $currentPage, max(0, $pageNum_rs_installs - 1), $queryString_rs_installs); ?>">Previous</a> <?php } ?></td> <td><?php if ($pageNum_rs_installs < $totalPages_rs_installs) { ?> <a href="<?php printf("%s?pageNum_rs_installs=%d%s", $currentPage, min($totalPages_rs_installs, $pageNum_rs_installs + 1), $queryString_rs_installs); ?>">Next</a> <?php } ?></td> <td><?php if ($pageNum_rs_installs < $totalPages_rs_installs) { ?> <a href="<?php printf("%s?pageNum_rs_installs=%d%s", $currentPage, $totalPages_rs_installs, $queryString_rs_installs); ?>">Last</a> <?php } ?></td> </tr></table> // then below that i have a do while loop do { //some stuff }while($row_rs_installs = odbc_fetch_array($rs_installs));
×
×
  • 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.