Maybe use a "id" field with a number so you can use that as the ordering field. Then just update the db as need based on the arrow movements. Going to be a rather annoying sql update statement .. but it's possible.
-
Feb 21st, 2008 09:29 AM #1
PHP + MySQL programming help needed; a call to programmers abroad!
I'm in the middle of writing a web application in php, which uses a mysql database as the back end.
Anyway, I'm working on an interface to display a list of items. The list allows for the order of the items to be customized, so I've placed UP and DOWN arrow icons beside each line to allow the row to be moved up and down within the list.
The first row only gets a DOWN arrow (since it can't be moved any higher on the list) and the last row should only get a UP arrow (since it can't be moved any lower on the list).
What I don't know how to do is detect the last row displayed, so it only displays one arrow.
Any ideas on how to accomplish this?_______________
Photography blog: photo.onsendesigns.com
Reply With Quote
LOG IN TO THANK
No one has yet thanked Outsider for this post.
-
Sponsored Links - Join the RedFlagDeals.com community and remove this ad.
-
Feb 21st, 2008 09:37 AM #2_______________
Silver Bullet VII || SilverStone TJ09 | Corsair AX 850W | Core i7 2600K | Thermalright Venomous X | Asus Maximus IV Extreme B3
eVGA GTX680 SLI | G.Skill Ripjaws X PC3-17066 8GB | Intel 160GB G2 | Samsung F3 1TB in RAID 5 | Pioneer DVR 212D | 3 x 2408WFP
WHS 2011 || Norco 4020 | Corsair AX 750W | SM X9SCL-F | Xeon E3-1220 | 8 x EcoGreen F4 2TB in RAID6 | LSI 9260-4i | Intel RES2SV240 | Intel 80GB G2 | WHS2011
Reply With Quote
LOG IN TO THANK
No one has yet thanked Silver Bullet for this post.
-
Feb 21st, 2008 09:52 AM #3
How about checking the length of the list? Or checking for null for next item's in the list?
Reply With Quote
LOG IN TO THANK
No one has yet thanked Tereno for this post.
-
Feb 21st, 2008 09:55 AM #4
I am currently using a 'sort_order' field to sort by.
And the arrows just change the values in that column.
Is there a way of finding out how many items an sql query returns?_______________
Photography blog: photo.onsendesigns.com
Reply With Quote
LOG IN TO THANK
No one has yet thanked Outsider for this post.
-
Feb 21st, 2008 09:59 AM #5
there is a "count" command... link
_______________
Silver Bullet VII || SilverStone TJ09 | Corsair AX 850W | Core i7 2600K | Thermalright Venomous X | Asus Maximus IV Extreme B3
eVGA GTX680 SLI | G.Skill Ripjaws X PC3-17066 8GB | Intel 160GB G2 | Samsung F3 1TB in RAID 5 | Pioneer DVR 212D | 3 x 2408WFP
WHS 2011 || Norco 4020 | Corsair AX 750W | SM X9SCL-F | Xeon E3-1220 | 8 x EcoGreen F4 2TB in RAID6 | LSI 9260-4i | Intel RES2SV240 | Intel 80GB G2 | WHS2011
Reply With Quote
LOG IN TO THANK
No one has yet thanked Silver Bullet for this post.
-
Feb 21st, 2008 11:48 AM #6
or just use mysql_num_rows on your resutl string.
http://ca3.php.net/mysql_num_rows_______________
HEATWARE (21 - 0) - evilbaby
Reply With Quote
LOG IN TO THANK
No one has yet thanked Evil Baby for this post.
Search Forums



