Hi Alex, I don't think you need row numbers to accomplish paging. I've written some PHP code below, which you'll need to tweak a bit. If you can put the page number in the querystring:- http://www.something.com/somepage.php?page=3 Then you can tweak the SQL statement with a limit clause:- <?php ... Extract($_GET); //exposes variables from the querystring $recordsPerPage = 5; //Number of records on each page //If page number not set, then set it to 1 If (!$page) { $page = 1; } //Calculate the first record you want to retrieve on this page //Index is zero-based $firstRecord = $recordsPerPage * ($page-1); //Now build the SQL query with the limit clause $query = "select <fieldNames> From <tableName> Where <whereClause> Limit $firstRecord, $recordsPerPage"; ... ?> Let us know if this works for you. Cheers, Lynn Lynn Holdsworth Web Analyst/Programmer - www.rnib.org.uk -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Alex Hall Sent: 08 April 2009 12:47 To: programmingblind@xxxxxxxxxxxxx Subject: Re: quick mysql question Okay. How would I use this to control which records are displayed? Say I have records 1-8, and the php page displays the first two, then the next two, and so on, moving to the next two every time a "next" button is clicked. How would the page know which two (or however many it was set to display per page) to get? What if the user wants to go back? Does this make sense? Sorry if this comes out looking strange, I think my bn's ueb translator is going crazy. Have a great day, Alex > ----- Original Message ----- >From: "Octavian Rasnita" <orasnita@xxxxxxxxx >To: <programmingblind@xxxxxxxxxxxxx >Date sent: Wed, 8 Apr 2009 08:28:16 +0300 >Subject: Re: quick mysql question >The indexes in a table are used for creating relations with the records from >other tables, and it would be a total mess if those indexes would change. >If you need to find how many records there are in a table, you can simply >count them using: >select count(*) from table_name; >Or you can put some conditions like: >select count(*) from table_name where column1=123 and another_column="abc" >and another_one like '%bla%'; >-- >Octavian >----- Original Message ----- >From: "Alex Hall" <mehgcap@xxxxxxx >To: <programmingblind@xxxxxxxxxxxxx >Sent: Wednesday, April 08, 2009 6:21 AM >Subject: Re: quick mysql question >> Okay, so the numbering is lost if you delete. Is there a more robust way >> of numbering, so that you would have gotten: >> 1, abc' >> 2, 'ghi' >> 3, 'kno' >> instead? I need the index of each record to always be sequential so that I >> can know how many total records there are and also know which ones I have >> used in the displaying of all of them. >> Have a great day, >> Alex >>> ----- Original Message ----- >>>From: "R. Haynie" <rhaynie@xxxxxxxxxxx >>>To: programmingblind@xxxxxxxxxxxxx >>>Date sent: Tue, 07 Apr 2009 22:51:24 -0400 >>>Subject: Re: quick mysql question >>>An example is worth a thousand words... >>>create table tbl1 (fld1 INTEGER AUTO_INCREMENT, >>>fld2 char(3), >>>PRIMARY KEY (fld1)); >>>insert into tbl1 (fld2) values ('abc'), ('def'), ('ghi'), >> ('jkl'); >>>select * from tbl1; >>>-- gives you: >>>1, 'abc' >>>2, 'def' >>>3, 'ghi' >>>4, 'jkl' >>>delete from tbl1 where fld1 in (2, 4); >>>insert into tbl1 (fld2) values ('mno'); >>>select * from tbl1; >>>-- gives you: >>>1, 'abc' >>>3, 'ghi' >>>5, 'mno' >>>HTH. >>>-Rodney >>>Alex Hall wrote: >>>> Hi all, >>>> If I have a table of records and one column is an autoincrement, >> what >>>> happens when I delete a record? I want to use the autoincrement >> as an >>>> index, so records 1, 2, 3, and 4 exist where 1-4 are the indexes >> of >>>> the records, If you delete record 3, do you then have records 1, >> 2, >>>> and 3, or 1, 2, and 4? If it is the second case, is there a >> better way >>>> to have an index of each record? I need to know how many >> recordsI am >>>> using on a page (it is sort of a photo viewer so I need to know >> which >>>> pictures are being shown and how many more there are) and how >> many >>>> total there are to go. Thanks. >>>> Have a great day, >>>> Alex >>>> __________ >>>> View the list's information and change your settings at >>>> //www.freelists.org/list/programmingblind >>>__________ >>>View the list's information and change your settings at >>>//www.freelists.org/list/programmingblind >> __________ >> View the list's information and change your settings at >> //www.freelists.org/list/programmingblind >__________ >View the list's information and change your settings at >//www.freelists.org/list/programmingblind __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind -- DISCLAIMER: NOTICE: The information contained in this email and any attachments is confidential and may be privileged. If you are not the intended recipient you should not use, disclose, distribute or copy any of the content of it or of any attachment; you are requested to notify the sender immediately of your receipt of the email and then to delete it and any attachments from your system. RNIB endeavours to ensure that emails and any attachments generated by its staff are free from viruses or other contaminants. However, it cannot accept any responsibility for any such which are transmitted. We therefore recommend you scan all attachments. Please note that the statements and views expressed in this email and any attachments are those of the author and do not necessarily represent those of RNIB. RNIB Registered Charity Number: 226227 Website: http://www.rnib.org.uk This message has been scanned for viruses by Websense Hosted Security - http://www.websense.com/content/HostedEmailSecurity.aspx __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind