MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 30th, 2003, 02:37 AM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
pushing mysql rows around

alright... aside from simply getting rows from a query and then updating those rows, and then putting the old row info into the next row, is there any way to jsut, make the row scoot down? So that when I update a row, it doesn't replace it, jsut pushes that row down, and makes a new row?
And if not...
I want my users tobe able to have six items in their personal database info. I want them to be able to change these items, adding a new one, pushing the other 5 items down, which would delete the si basically. I had done this with complex queries and passing from the url, but their must be a better way!

any one have answers to any of this? Thanks!
__________________
hey it's the CHARKING

Reply With Quote
  #2  
Old September 2nd, 2003, 07:01 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
You just need to give each row a numeric position column whose value the users can change at will; then order by position when selecting out of the database.

Reply With Quote
  #3  
Old September 4th, 2003, 10:39 AM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
well I don't want the users to change the order, not as though it were something they even know is changing. Just so when they upload a picture, it would push the other pictures down the lsit, making the most recent pic uploaded the first pic loaded... I think i will have to do this how I had done it before, passing a lot of variables through the url and such. But maybe I misunderstood you. Thanks at any rate.

Reply With Quote
  #4  
Old September 4th, 2003, 11:04 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Nah, you could still add an auto_increment field and order by that field descending when you display the pictures. Or if you've already got an auto_increment field, maybe a timestamp. No need to move whole sets of rows, at any rate.

Reply With Quote
  #5  
Old September 4th, 2003, 05:08 PM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
hmm, that's true... but will all of those extra old entries get a bit big and fill the db? Although I have been meaning to look into that, I can't remember what it was called, but I think it sort of cleaned out of db entries and stuff... is there a way to do that.... maybe jsut a script that checks the date of an entry, oh wait I know, maybe jsut does a query between the 1st entry and the 7th to last entry or something... is that possible? Or the best way to go about it? And then the old pics, I suppose that result from that query can just be used to delete them at the same time... am I on the right track here?
thanks for your help, you've got me thinkin about it again, heh.

Reply With Quote
  #6  
Old September 5th, 2003, 06:52 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Yeah, you could either delete old entries upon insert or have a script that runs weekly or nightly that deletes old entries. And I wouldn't even worry about that unless you expect a lot of activity and have severely limited db space.

Reply With Quote
  #7  
Old February 7th, 2004, 10:07 AM
Wriker Wriker is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 2 Wriker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by dhouston
You just need to give each row a numeric position column whose value the users can change at will; then order by position when selecting out of the database.

A small question from a newbie about this. How do I do this? I assume I can't have the same number more than once, so do I have to change EVERY number of EACH row every time I alter one number? That's much too big a query, isn't it?

Reply With Quote
  #8  
Old February 9th, 2004, 07:02 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
If your position isn't an auto_increment field or a unique field, you can have duplicate numbers and just do a second order by for name or another criterion in case there are multiples of the same number. Unless you've got somebody organizing a whole lot of information, this wouldn't require too many queries. In fact, if you follow the lead of the Nukes and have an interface that allows you to push items up or down in a stack, you're only ever changing two rows for a given item shift. (increment the number of the one and decrement the one adjacent to it).
__________________
Please don't PM me asking for solutions outside the scope of a thread.
Keeping all responses in a thread stands to help others who come along later,
which is after all what this forum's all about.

Reply With Quote
  #9  
Old February 9th, 2004, 07:23 AM
Wriker Wriker is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 2 Wriker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You're right, I had just realised it, too. I just need to add one more field for the "order number", instead of using the auto-increment "id" field. Thanks for your reply.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > pushing mysql rows around


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway