[PHP-DB] Next/Prev 10 lines

2002-12-20 Thread Steve Dodkins
Has anyone got some code that will correctly display the next 10 line of a
table with prev and next working?
Or point me in the right direction for help?

Regards

Steve Dodkins

IMPORTANT NOTICE The information in this e-mail is confidential and should
only be read by those persons to whom it is addressed and is not intended to
be relied upon by any person without subsequent written confirmation of its
contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the
accuracy or completeness of this message as it has been transmitted over a
public network.   Furthermore, the content of this e-mail is the personal
view of the sender and does not represent the advice, views or opinion of
our company. Accordingly, our company disclaim all responsibility and accept
no liability (including in negligence) for the consequences of any person
acting, or refraining from acting, on such information prior to the receipt
by those persons of subsequent written confirmation. In particular (but not
by way of limitation) our company disclaims all responsibility and accepts
no liability for any e-mails which are defamatory, offensive, racist or in
any other way are in breach of any third party's rights, including breach of
confidence, privacy or other rights. If you have received this e-mail
message in error, please notify me immediately by telephone. Please also
destroy and delete the message from your computer. Any form of reproduction,
dissemination, copying, disclosure, modification, distribution and/or
publication of this e-mail message is strictly prohibited.  If you have
received this E-mail in error, or suspect that the message may have been
intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245
468555.
ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Next/Prev 10 lines

2002-12-20 Thread Jason Wong
On Friday 20 December 2002 23:16, Steve Dodkins wrote:
 Has anyone got some code that will correctly display the next 10 line of a
 table with prev and next working?
 Or point me in the right direction for help?

Search the archives. This kind of question gets asked (and sometimes answered) 
every other day (or so it seems).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
Nihilism should commence with oneself.
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Next/Prev 10 lines

2002-12-20 Thread Cal Evans
check out php.weblogs.com

ADODB does this for you.

=C=

*
* Cal Evans
* The Virtual CIO
* http://www.calevans.com
*


-Original Message-
From: Steve Dodkins [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 20, 2002 9:16 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Next/Prev 10 lines


Has anyone got some code that will correctly display the next 10 line of a
table with prev and next working?
Or point me in the right direction for help?

Regards

Steve Dodkins

IMPORTANT NOTICE The information in this e-mail is confidential and should
only be read by those persons to whom it is addressed and is not intended to
be relied upon by any person without subsequent written confirmation of its
contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the
accuracy or completeness of this message as it has been transmitted over a
public network.   Furthermore, the content of this e-mail is the personal
view of the sender and does not represent the advice, views or opinion of
our company. Accordingly, our company disclaim all responsibility and accept
no liability (including in negligence) for the consequences of any person
acting, or refraining from acting, on such information prior to the receipt
by those persons of subsequent written confirmation. In particular (but not
by way of limitation) our company disclaims all responsibility and accepts
no liability for any e-mails which are defamatory, offensive, racist or in
any other way are in breach of any third party's rights, including breach of
confidence, privacy or other rights. If you have received this e-mail
message in error, please notify me immediately by telephone. Please also
destroy and delete the message from your computer. Any form of reproduction,
dissemination, copying, disclosure, modification, distribution and/or
publication of this e-mail message is strictly prohibited.  If you have
received this E-mail in error, or suspect that the message may have been
intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245
468555.
ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Next/Prev 10 lines

2002-12-20 Thread Hynek Semecký ME
First you have to find how many rows would make your SELECT query in
case you would not use LIMIT from, num.
Then you have to divide this by number of rows per page and use it
in the SELECT query.
Then to your number of pages displayed on your page you add links to
the first number of the LIMIT part in your query.
Maybe something like this:

?
# Counting rows
$page_limit = 10; # 10 Rows will be displayed per page
if(!$page_start) {
$page_start = 0;
}

$query = SELECT COUNT(*) FROM your_table;
if(!($dbq_result = mysql_query($dbq))) {
echo YOU HAVE ERRORS IN YOUR QUERY;
} else {
while($row = mysql_fetch_array($dbq_result)) {
# Getting number of pages - float rounded up
# This will be used in later page numbers displaying in HTML.
$num_pages = ceil(($row[0] / $page_limit));
}
}

# Selecting rows
$dbq = SELECT your_fields FROM your_table LIMIT $page_start, $page_limit;
if(!($dbq_result = mysql_query($dbq))) {
echo YOU HAVE ERRORS IN YOUR QUERY;
}
?

YOUR rows displayed ...

?
if($num_pages  1) {
echo GO TO PAGE NUMBER: ;
for($i = 1; $i = ($num_pages); $i++) {
if($set_page_start == $page_start) {
echo $i ;
} else {
echo a 
href=\your_file.php?page_start=$set_page_start$i/a ;
}
$set_page_start = $set_page_start + $page_limit;
}
?

If you want to use PREV, NEXT instead of page numbers,
just modify a little the second code paragraph.

Merry Christmas to all !

Hynek


Hynek Semecký
www.semecky.com
www.perlickovekoupele.cz
Profi Web Hosting: http://www.web4u.cz/index.php?page=Programyrid=2837



-Original Message-
From: Steve Dodkins [mailto:[EMAIL PROTECTED]]
Sent: 20. prosince 2002 16:16
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Next/Prev 10 lines


Has anyone got some code that will correctly display the next 10 line of a
table with prev and next working?
Or point me in the right direction for help?

Regards

Steve Dodkins

IMPORTANT NOTICE The information in this e-mail is confidential and should
only be read by those persons to whom it is addressed and is not intended to
be relied upon by any person without subsequent written confirmation of its
contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the
accuracy or completeness of this message as it has been transmitted over a
public network.   Furthermore, the content of this e-mail is the personal
view of the sender and does not represent the advice, views or opinion of
our company. Accordingly, our company disclaim all responsibility and accept
no liability (including in negligence) for the consequences of any person
acting, or refraining from acting, on such information prior to the receipt
by those persons of subsequent written confirmation. In particular (but not
by way of limitation) our company disclaims all responsibility and accepts
no liability for any e-mails which are defamatory, offensive, racist or in
any other way are in breach of any third party's rights, including breach of
confidence, privacy or other rights. If you have received this e-mail
message in error, please notify me immediately by telephone. Please also
destroy and delete the message from your computer. Any form of reproduction,
dissemination, copying, disclosure, modification, distribution and/or
publication of this e-mail message is strictly prohibited.  If you have
received this E-mail in error, or suspect that the message may have been
intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245
468555.
ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php