ayok Posted December 25, 2007 Share Posted December 25, 2007 Hi, For example, I have this table on mysql Name Age John 35 Mario 23 Ben 24 How can I move Mario up or down in php? Is it possible? Thank you ayok Quote Link to comment https://forums.phpfreaks.com/topic/83153-mysql-table/ Share on other sites More sharing options...
revraz Posted December 25, 2007 Share Posted December 25, 2007 What do you want to base the logic on, being the youngest or just on his name? Quote Link to comment https://forums.phpfreaks.com/topic/83153-mysql-table/#findComment-422943 Share on other sites More sharing options...
ayok Posted December 25, 2007 Author Share Posted December 25, 2007 Ehm.. Let's say in the mysql table Id name 1. John 2. Mario 3. Ben How can I switch Mario into #1 and John #2? Thanks, ayok Quote Link to comment https://forums.phpfreaks.com/topic/83153-mysql-table/#findComment-422995 Share on other sites More sharing options...
revraz Posted December 25, 2007 Share Posted December 25, 2007 If that's the only two fields in your DB, then just do a UPDATE statement and change the names. But if there are other fields in the record as well, you're better off trying to find a solution on how to sort or display the data as you need, rather than changing it in the DB. Quote Link to comment https://forums.phpfreaks.com/topic/83153-mysql-table/#findComment-423026 Share on other sites More sharing options...
fenway Posted December 27, 2007 Share Posted December 27, 2007 I don't like the fact that you're referring to #1 as UID 1 -- don't change UIDs *ever*. Order the results by something else. Quote Link to comment https://forums.phpfreaks.com/topic/83153-mysql-table/#findComment-424085 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.