Re: Re: php mysql problem
| From: | Dave Goodchild | Date: | Tue, 02 May 2006 13:26:51 +0000 |
| Subject: | Re: Re: php mysql problem | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235263@lists.php.net to get a copy of this message | ||
Exactly - I don't think you really understand how a relational database
works. The ids are retained as they may relate to records in another table.
Internal sorting order is of no relevance at the application level. I think
you need to rethink your design a little.
On 02/05/06, T.Lensselink <admin@ensifex.nl> wrote:
This is my database now...I will use the item_id for the order but what if I want to change item_id 3 to item id 1? How can I push all the items down one place? How can I delete any gaps when items are deleted. CREATE TABLE-- http://www.web-buddha.co.uk dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css) look out for project karma, our new venture, coming soon!board_papers(idint(4) NOT NULL auto_increment,doc_datevarchar(10) NOT NULL default '0000-00-00',article_typeenum('agenda','minutes','paper') NOT NULL default 'agenda',fileNamevarchar(50) NOT NULL default '',fileSizeint(4) NOT NULL default '0',fileTypevarchar(50) NOT NULL default '',contentblob NOT NULL,item_idint(10) default NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; ""Ross"" <ross@aztechost.com> wrote in message news:6C.5F.05123.70D27544@pb1.pair.com...1,Just say I have a db CREATE TABLEmytable(idint(4) NOT NULL auto_increment,fileNamevarchar(50) NOT NULL default '', PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ; when I add items they go id 1,2,3 etc. Whn I delete them gaps appear.-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Really can't imagine why you wanna do something like this. What's the use in reordering a database. It's just a database. you can sort it in any way you like.. gaps or not.. Sounds to me the sorting is only done on screen. This is pretty easy done with PHP not in the database itself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php3, 7. I need to know (a) when items are removed how can I sort the database to all the gaps are take out 1, 3, 7 becomes 1,2,3 (b) allow the ids to be changed so the items can change position in the list. If I change id 3 to id 1 then everything else shifts down. If anyone has seen the amazon dvd rental list where you can swap dvd to the top of the list and delete this is what I am trying to achive with php/mysql.