Re: Next and Preview Row
| From: | Andrey Hristov | Date: | Fri, 22 Feb 2002 15:20:26 +0000 |
| Subject: | Re: Next and Preview Row | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-85853@lists.php.net to get a copy of this message | ||
My dump:
# phpMyAdmin MySQL-Dump
# http://phpwizard.net/phpMyAdmin/
#
# Host: 192.168.1.11:3306 Database : test
# --------------------------------------------------------
#
# Table structure for table 'some'
#
CREATE TABLE some (
id varchar(6) NOT NULL,
descr varchar(250) NOT NULL
);
#
# Dumping data for table 'some'
#
INSERT INTO some VALUES ( 'ID0001', 'first line');
INSERT INTO some VALUES ( 'ID0002', 'Second line');
INSERT INTO some VALUES ( 'ID0010', 'Third row');
INSERT INTO some VALUES ( 'ID0015', 'Fourth row');
INSERT INTO some VALUES ( 'ID0023', 'Fifth row');
INSERT INTO some VALUES ( 'ID0026', 'Sixth row');
Try this sql on this table:
select * from some where id<'ID0015' order by id desc limit 0,1;
select * from some where id>'ID0015' order by id limit 0,1;
Best regards,
Andrey Hristov
----- Original Message -----
From: "Mark Lo" <markloky@netvigator.com>
To: <mysql@lists.mysql.com>; <php-general@lists.php.net>
Cc: <markloky@netvigator.com>
Sent: Friday, February 22, 2002 5:15 PM
Subject: [PHP] Next and Preview Row
> Dear All,
>
> I am using PHP + MYSQL. I have a question that I need some expert
> to help. That is:
>
> How do I find out a next and preview row values by using PHP and MYSQL. For
> examples,
>
> Row 10 ID00010 need this value
> Row 11 ID00025 have this value on hand
> Row 12 ID00063 need this value
>
> The questions is how do I find out the values in Row 10 and Row 12, if and
> only if I only have one data that is "ID00025" (select * from table where
> field="ID00025") . But, the questions is How do I find out the data in Row
> 10 and Row 12 which is "ID00010" and "ID00063" assume I don't know the
> values of "ID00025" is in Row 11.
>
> Thank you so much for your help.
>
>
> Mark Lo
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>