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




Re: [PHP-DB] Next N Interface

2002-09-30 Thread Brad Bonkoski

I did something like this with a photo gallery I made.  The approach I took is
the execute a query, get the number of rows, and divide that number by how ever
many records I wanted on that page.  Then that would give me the number of total
pages I would have for my navigational links at the bottom.  Then I would pass a
page number from page to page and multiply this by the number of records which
would give me the first record to display from the same query.  Soem sample
code:  (I displayed 4 pictures/records per page)
$num_rows = mysql_num_rows($result);

//Check to see if any rows are present
if ($num_rows = 0)
{
echo centerh2No Pictures Available in this Album/h2/center;
exit(1);
}
$x = ($num_rows/4);
$y = intval($x);
if ($x  $y)
{
$num_pages= $y+1;
}
else
{
$num_pages= $x;
}
$curr_row = ($curr_page*4);

if ($DEBUG  0)
{
echo Curr_row is: $curr_rowbr;
}
mysql_data_seek($result, $curr_row);

HTH
-Brad

Lucas Novæ Matrix wrote:

 Hello,

 I am trying to create a next n interface through php4, using results from
 a mysql query. I did this in the past easily with ColdFusion, but this time
 it's a bit more complicated.

 What I need to do basicaly is to have only 5 results per page. The first
 page displays the 5 results and Next Page  at the bottom, the second
 page displays results 6 to 10 and displays  Previous Page | Next Page
  , up until the last page that displays only the previous page, and the
 last results (from 1 to 5).

 I don't necessarely need to have each page as a number at the bottom, just
 the previous and next links. All I need basically is to either get or output
 only 5 rows at a time, with only needing the $_GET['startrow'] variable.

 Can anyone help me? (or just throw me a link to an existing page/script)

 Thanks,
 Éric.

 --
 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 N Interface

2002-09-30 Thread Mark Lee

How about appending  LIMIT _GET[startrow],5 to the end of your query.

The first parameter to LIMIT is the start position and the second is 
the number of rows to return.

Does this help, or am I misunderstanding your question?

Mark

Lucas Novæ Matrix wrote:

Hello,

I am trying to create a next n interface through php4, using results from
a mysql query. I did this in the past easily with ColdFusion, but this time
it's a bit more complicated.

What I need to do basicaly is to have only 5 results per page. The first
page displays the 5 results and Next Page  at the bottom, the second
page displays results 6 to 10 and displays  Previous Page | Next Page

 , up until the last page that displays only the previous page, and the

last results (from 1 to 5).

I don't necessarely need to have each page as a number at the bottom, just
the previous and next links. All I need basically is to either get or output
only 5 rows at a time, with only needing the $_GET['startrow'] variable.

Can anyone help me? (or just throw me a link to an existing page/script)

Thanks,
Éric.






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




Re: [PHP-DB] Next N Interface

2002-09-30 Thread Brad Bonkoski

That would actually work for just getting a certain number of records from a
query, but you would have to execute another query to figure out the navigational
links he said he wants on the bottom...like google has,  1 2 3 4 5 .  So,
when I attacked it I figured one query is better then two even if it returns a
whole bunch of records in the result that you are not using for that page. How is
that for performance?  which would be better?  Or even, is there an alternative
way to figureing out how many records are in a database?  Always more then one
way to skin a cat.
-Brad

Mark Lee wrote:

 How about appending  LIMIT _GET[startrow],5 to the end of your query.

 The first parameter to LIMIT is the start position and the second is
 the number of rows to return.

 Does this help, or am I misunderstanding your question?

 Mark

 Lucas Novæ Matrix wrote:

 Hello,
 
 I am trying to create a next n interface through php4, using results from
 a mysql query. I did this in the past easily with ColdFusion, but this time
 it's a bit more complicated.
 
 What I need to do basicaly is to have only 5 results per page. The first
 page displays the 5 results and Next Page  at the bottom, the second
 page displays results 6 to 10 and displays  Previous Page | Next Page
 
  , up until the last page that displays only the previous page, and the
 
 last results (from 1 to 5).
 
 I don't necessarely need to have each page as a number at the bottom, just
 the previous and next links. All I need basically is to either get or output
 only 5 rows at a time, with only needing the $_GET['startrow'] variable.
 
 Can anyone help me? (or just throw me a link to an existing page/script)
 
 Thanks,
 Éric.
 
 
 

 --
 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 N Interface

2002-09-30 Thread John W. Holmes

 That would actually work for just getting a certain number of records
from
 a
 query, but you would have to execute another query to figure out the
 navigational
 links he said he wants on the bottom...like google has,  1 2 3 4 5
.
 So,
 when I attacked it I figured one query is better then two even if it
 returns a
 whole bunch of records in the result that you are not using for that
page.
 How is
 that for performance?  which would be better?  Or even, is there an
 alternative
 way to figureing out how many records are in a database?  Always more
then
 one
 way to skin a cat.

Use two queries. A count(*) query and a LIMIT query to only return X
rows. If you have a smaller table, it might be okay to do it with on and
seek the rows you want, but it's inefficient and not scalable for large
tables. 

Previous/Next links are pretty simple with MySQL. Just pass a $page
variable between pages. Increment it with Next, decrement it with
Previous. Then, use it in your query like this:

$result1 = mysql_query(SELECT COUNT(*) FROM your_table WHERE ... );
$records = mysql_result($result,0);

$num_per_page = 5;
$start = $page * $num_per_page;

$num_pages = ceil($records / $num_per_page);

$result = mysql_query(SELECT * FROM your_table WHERE ... LIMIT $start,
$num_per_page);

Add in a little logic so $page isn't below zero and doesn't go above
your max pages, and you're golden...

---John Holmes...



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




RE: [PHP-DB] next prev links for search result

2002-08-27 Thread joakim . andersson

 -Original Message-
 From: Smita Manohar [mailto:[EMAIL PROTECTED]]
 Sent: Monday, August 26, 2002 8:26 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] next prev links for search result
 
 
 hiii..
 
 i want page no. and next prev links while displaying search 
 result. the 
 script which im using presently, needs to run the search 
 query 2 times for 
 each search operation.
 
 first time it finds all the records matching the query string,
 

Change this query:
 ie, select * from table where field like '%$search_string %'
 
To
SELECT COUNT(*) AS num_hits FROM table WHERE field LIKE '%$search_string%'
and let your MySQL-server do the counting. No need to transfer all data to
PHP just to count the rows.

You still have to run two queries, but I don't think you need to worry too
much about performance issues, unless you have a really, really huge table.

Regards
Joakim Andersson

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




RE: [PHP-DB] Next birthday?

2002-03-08 Thread Robert V. Zwink

The simple answer might be:

SELECT member.*
 FROM `member`
WHERE DAYOFYEAR(member_dob) = DAYOFYEAR(CURDATE())
ORDER BY member_dob DESC LIMIT 1

Seems to work for me.  The problem is that it wouldn't support members that
have a birthday on the same day :)  To solve that I would select the next
birthday from the 'member' table, then go back and select all the members
that have that birthday.  It also would not support selecting January
birthdays in December (which might be a problem Dec 31).

so you would actually need three queries:
SELECT member_dob
 FROM `member`
WHERE DAYOFYEAR(member_dob) = DAYOFYEAR(CURDATE())
ORDER BY member_dob DESC LIMIT 1

if that returns 0 results, then you would likely be in December trying to
show the next birthday in January.  Go back to the database starting with
January 1 and select brithdays starting at the begining of the year.

SELECT member_dob
 FROM `member`
WHERE DAYOFYEAR(member_dob) = 0
ORDER BY member_dob DESC LIMIT 1

then take that result and:

SELECT member.*
 FROM `member`
WHERE member_dob = '$result_from_previous_query'
ORDER BY last_name

This really seems like overkill.  This query would be much simpler if you
just showed everyone's birthday next month (or something like that).

Robert Zwink
http://www.zwink.net/daid.php

-Original Message-
From: Kristjan Kanarik [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 08, 2002 5:30 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Next birthday?


I have a table called 'members' with a field (among many others)
'member_dob' - the birthday of a particular member. The data type of this
field is date (-mm-dd).

What I'd like to do now is to fetch one particular row from the database
(I am using MySQL 3.23.37) - namely the row of the member who is the next
one to have a birthday. Can this be done only with a advanced query or
should I fetch all rows and use PHP to find out who is the next one to
have a birthday? I'd prefer letting MySQL to do the job...

Any ideas?

TIA,
Kristjan

P.S. Pls. CC to [EMAIL PROTECTED] as well - I am only on the digest.


--
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 birthday?

2002-03-08 Thread Kristjan Kanarik

On Fri, 8 Mar 2002, Robert V. Zwink wrote:

 The simple answer might be:

 SELECT member.*
  FROM `member`
 WHERE DAYOFYEAR(member_dob) = DAYOFYEAR(CURDATE())
 ORDER BY member_dob DESC LIMIT 1

 Seems to work for me.

Not for me. I think it should be ordered like this:
ORDER BY DAYOFYEAR(member_dob) ASC

Otherwise it will display the person who was born on 25th of March 1988
instead of the one born 11th of March 1980. Pls. correct me if I am wrong.

Thanks  Cheers,
Kristjan

P.S. Pls. CC to [EMAIL PROTECTED] - I am only on the digest.






 The problem is that it wouldn't support members that
 have a birthday on the same day :)  To solve that I would select the next
 birthday from the 'member' table, then go back and select all the members
 that have that birthday.  It also would not support selecting January
 birthdays in December (which might be a problem Dec 31).

 so you would actually need three queries:
 SELECT member_dob
  FROM `member`
 WHERE DAYOFYEAR(member_dob) = DAYOFYEAR(CURDATE())
 ORDER BY member_dob DESC LIMIT 1

 if that returns 0 results, then you would likely be in December trying to
 show the next birthday in January.  Go back to the database starting with
 January 1 and select brithdays starting at the begining of the year.

 SELECT member_dob
  FROM `member`
 WHERE DAYOFYEAR(member_dob) = 0
 ORDER BY member_dob DESC LIMIT 1

 then take that result and:

 SELECT member.*
  FROM `member`
 WHERE member_dob = '$result_from_previous_query'
 ORDER BY last_name

 This really seems like overkill.  This query would be much simpler if you
 just showed everyone's birthday next month (or something like that).

 Robert Zwink
 http://www.zwink.net/daid.php

 -Original Message-
 From: Kristjan Kanarik [mailto:[EMAIL PROTECTED]]
 Sent: Friday, March 08, 2002 5:30 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Next birthday?


 I have a table called 'members' with a field (among many others)
 'member_dob' - the birthday of a particular member. The data type of this
 field is date (-mm-dd).

 What I'd like to do now is to fetch one particular row from the database
 (I am using MySQL 3.23.37) - namely the row of the member who is the next
 one to have a birthday. Can this be done only with a advanced query or
 should I fetch all rows and use PHP to find out who is the next one to
 have a birthday? I'd prefer letting MySQL to do the job...

 Any ideas?

 TIA,
 Kristjan

 P.S. Pls. CC to [EMAIL PROTECTED] as well - I am only on the digest.


 --
 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

2001-11-14 Thread Andrey Hristov

Use sessions. (session_start() and session_register()), and at the start of the test 
save row_ids(question_ids) in arrray which you
make with session_register a session variable. On other pages you do session_start() 
and after that you have access to the array.

Regards,
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS



- Original Message -
From: Peter Allum [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 14, 2001 11:37 AM
Subject: [PHP-DB] Next


 I am writing a questionaire, am gonna include java timer etc... and it is
 written in PHP 4 and Mysql running on Apache.

 I have my questionaire database full of questions I randomly select say 40
 questions. But rather than display the whole array on the screen I would
 like to have 1 question per page and a next button. I hope that makes sense
 any ideas anyone?

 Many thanks for you halp in advance.

 Peter

 --
 Regards,




 Peter Allum
 Connect U Ltd
 
 **
 Confidentiality: This email and its attachments are intended for the above
 name only and may be confidential. If they have come to you in error you
 must take no action based upon them, nor must you copy or show them to
 anyone.
 Please reply to this email and highlight the error.
 Security Warning: Please note that this email has been created in the
 knowledge that Internet email is not a 100% secure medium.
 We advise that you understand and observe this lack of security when
 emailing us.
 Viruses: Although we have taken steps to ensure that this email and
 attachments are free from any virus, we advise that in keeping with good
 computing practice the recipient should ensure they are actually virus free.
 [EMAIL PROTECTED]
 
 **



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Next

2001-11-14 Thread Rick Emery

Pass the current question number in a parameter to the next page in the URL.
In the following, the PHP variable would track your current page:

print A href=\myform.php3?page=$page\Next/A;

-
then, in myform.php3:

?php
$page++;

display the question for this page
?

-Original Message-
From: Peter Allum [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 3:38 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Next 


I am writing a questionaire, am gonna include java timer etc... and it is
written in PHP 4 and Mysql running on Apache.

I have my questionaire database full of questions I randomly select say 40
questions. But rather than display the whole array on the screen I would
like to have 1 question per page and a next button. I hope that makes sense
any ideas anyone?

Many thanks for you halp in advance.

Peter

--
Regards,




Peter Allum
Connect U Ltd

**
Confidentiality: This email and its attachments are intended for the above
name only and may be confidential. If they have come to you in error you
must take no action based upon them, nor must you copy or show them to
anyone.
Please reply to this email and highlight the error.
Security Warning: Please note that this email has been created in the
knowledge that Internet email is not a 100% secure medium.
We advise that you understand and observe this lack of security when
emailing us.
Viruses: Although we have taken steps to ensure that this email and
attachments are free from any virus, we advise that in keeping with good
computing practice the recipient should ensure they are actually virus free.
[EMAIL PROTECTED]

**



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] NEXT - PREVIOUS coding

2001-07-16 Thread Tom Hodder

rough and readysomething like this should work...

$pagesize = 20;
$page = $page ? $page : 1;
$pages = ceil(mysql_num_rows( $results ) / $pagesize );
mysql_data_seek( $results, ($page - 1) * $pagesize );

while( ($row = mysql_fetch_object( $results ))  ( $counter++ 
$pagesize) )
{
//  print rows of data etc etc
}

if( ($page  1) )
{
print a href=?page=.($page + 1).Next/a;
}

if( ($page  $pages)  ( $pages  1 )  )
{
print a href=?page=.($page + 1).Next/a;
}






-Original Message-
From: Pranot Kokate [mailto:[EMAIL PROTECTED]]
Sent: 16 July 2001 09:40
To: [EMAIL PROTECTED]
Subject: [PHP-DB] NEXT - PREVIOUS coding


hi.. friends

i have a database (mysql) in which their r many records. Through PHP i want
them to display on the page.

Main requirement is that there should be a NEXT - PREVIOUS facility. So if
there r 20 records and suppose only 10 should show up on scren at a time,
then a NEXT link should be visible which could show the remaining 10
records.

Their can be n no. of records.

Pls help.

Kind Regards,
Pranot


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] next previous record

2001-02-22 Thread Lennin Arriola

 Keep a counter of the rows you have fetched.   so when you want to go back
 call mysql_data_seek ($Result,  Counter-1);
 then mysql_fetch
 and you've got the previous row.
 
 
 Lennin Arriola
 [EMAIL PROTECTED]
 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] next previous record

2001-02-22 Thread JJeffman

I don't know about "Cursors" but I think you can use the same approach we
discussed on navigate record by record, " retrieval of NEXT, PREV records"
was the subject.

If set an order by clause and search for the first record you can use a
where clause like this :
...
$current = $row["field"] ;
// for next row
$query = "select * from table where field_name  '$current' limit 1";
// for previous row
$query = "select * from table where field_name  '$current' limit 1";

HTH

Jayme.
www.conex.com.br/jjeffman/antispam.html

-Mensagem Original-
De: Andrew Hill [EMAIL PROTECTED]
Para: Dreamvale [EMAIL PROTECTED]; [EMAIL PROTECTED]
Enviada em: quinta-feira, 22 de fevereiro de 2001 14:10
Assunto: RE: [PHP-DB] next  previous record


 You want to use Cursors, and I don't believe MySQL supports cursors yet,
 although I could be wrong.

 Best regards,
 Andrew
 --
 Andrew Hill - OpenLink Software
 Director Technology Evangelism
 eBusiness Infrastructure Technology
 http://www.openlinksw.com


  -Original Message-
  From: Dreamvale [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, February 22, 2001 11:42 AM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] next  previous record
 
 
  I was not refering pagination.
 
  suppossing there are these 3 records
 
  ABC
  DEF
  GHI
  LJK
 
  now a search is done by entering D, which using like  %, and limit
would
  return the record DEF. The "next" would forward to GHI and
  "previous" would
  backward to ABC.
 
  any idea?
 
  thanks.
 
 
  - Original Message -
  From: "Brunner, Daniel" [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Friday, February 23, 2001 12:12 AM
  Subject: FW: [PHP-DB] next  previous record
 
 
Check this link out...
   
http://www.oreillynet.com/pub/a/php/2000/11/02/next_previous.html?page
=1
   
It's about Next/previous links...
   
It does work, but I've yet to get to get it to work completely with
displaying the records (rows) and the links at the same time...
   
It just takes some time to find how to use the mysql_query variable
to
print out the rows, with every click of the link..
   
If you get any head way let me know...
   
It's great code
   
Dan
   
   
   
--
From: Dreamvale
Sent: Thursday, February 22, 2001 9:55 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] next  previous record
   
hi all,
   
need to implement record scrolling, one at a time -either forward or
backward, on MySQL. The key is a char (32) containing part numbers.
   
anyone has done this before?
   
thanks in advance.
   
dreamvale
   
   
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail:
[EMAIL PROTECTED]
   
   
   
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail:
[EMAIL PROTECTED]
  
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]