Forums

PHP

This topic is locked

PHP, MySQL, Array, change ID Numbers?

Posted 27 Apr 2005 16:28:37
1
has voted
27 Apr 2005 16:28:37 Matt Bailey posted:
Can anyone point me in the right direction?

I have 6 rows in a database table, which in addition to a unique primary key, each have a column called PositionID. This PositionID can be 1,2,3,4,5 or 6. My question is, how can I allow the user to re-order the rows based on the ID number? Obviously I could let them change each number individually, but I'd like the other numbers to change automatically so you don't get two numbers the same.

I believe you'd have to set up some kind of array, which can be manipulated by the user and then re-posted back to the database.

Any help would be good - links to other sites, tutorials etc.

___________________________________
* Sorry... how do you do that again?... *

Replies

Replied 27 Apr 2005 18:28:17
27 Apr 2005 18:28:17 Chris Charlton replied:
Wow, ya, I'd be pushing the ID's into a PHP Array and sort and play with it there. You'll be UPDATEing multiple rows at a time, but it'll be a fast loop.

~ ~ ~ ~ ~ ~ ~
Chris Charlton <i>- DMXzone Manager</i>
<font size=1>[ Studio MX/MX2004 | PHP/ASP | SQL | XHTML/CSS | XML | Actionscript | Web Accessibility | MX Extensibility ]</font id=size1>
Replied 27 Apr 2005 19:09:20
27 Apr 2005 19:09:20 Matt Bailey replied:
That's as I thought, thanks for confirming it for me. Don't suppose you can point me in the direction of any websites/tutorials that might be able to help (if you know of any). Hardcoding it is going to be a bit beyond me I fear!

___________________________________
* Sorry... how do you do that again?... *
Replied 28 Apr 2005 04:44:00
28 Apr 2005 04:44:00 Chris Charlton replied:
Do a quick search here on DMXzone for "multiple update", "multiple rows", etc. And you'll find! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

~ ~ ~ ~ ~ ~ ~
Chris Charlton <i>- DMXzone Manager</i>
<font size=1>[ Studio MX/MX2004 | PHP/ASP | SQL | XHTML/CSS | XML | Actionscript | Web Accessibility | MX Extensibility ]</font id=size1>

Reply to this topic