Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

PHP/MSSQL Results per page
Does anyone have a good tutorial or example code for doing results per page
in PHP with MSSQL?

Report this thread to moderator Post Follow-up to this message
Old Post
ABC123
11-25-04 01:56 AM


Re: PHP/MSSQL Results per page
This is untested in this form but should work :)
It does not do a next/previous link

//use $_get to get start value
//pagelen is number of results per page
$pagelen = 30;
//start is start number e.g. 0,30,60,90 etc
$start = 0;

$query = "SELECT * FROM table LIMIT " . $start . ", " . $pagelen;

/* page numbers */
$pagelist = "<p>Page ";
$pagetot = ceil($num_rows / $pagelen);
for($pagenum = 1; $pagenum <= $pagetot; $pagenum++) {
if($start == ($pagenum - 1) * $pagelen){
//put page number in without link if it is this page
$pagelist .= $pagenum . " ";
}
else{
//put page number in with link if its not this page
$pagelist .= "<a href=\"filename.php?start=" . ($pagenum - 1) *
$pagelen . "\">" . $pagenum . "</a> ";
}
}
$pagelist .= "</p>\n";


//then where you want the list put
print $pagelist;

ABC123 wrote:

> Does anyone have a good tutorial or example code for doing results
> per page in PHP with MSSQL?

Report this thread to moderator Post Follow-up to this message
Old Post
Rogue Rabbit
11-25-04 08:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP SQL archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:50 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.