jonw118 Posted February 17, 2010 Share Posted February 17, 2010 I have a unique situation where I have a php script that is very complex and I cannot do a simple order by priority. Instead it displays the data on the frontend in the exact order it is stored in the MySQL database. Is there any way (I've looked high and low!) to change the order that rows appear in the MySQL database. Ideally I'd like for the table to display the table rows in asc order by the column "page_name". Not sure this is possible to alter the table to achieve this. Does anyone know? Thanks much for any help! Quote Link to comment https://forums.phpfreaks.com/topic/192444-changing-row-order-in-mysql-using-phpmyadmin/ Share on other sites More sharing options...
trq Posted February 17, 2010 Share Posted February 17, 2010 I've looked high and low! You can stop looking. Databases do not store data in any particular order, it is up to you to write your select statements in such a way the the data is retrieved in the order you want. I have a php script that is very complex and I cannot do a simple order by priority. I fail to see why. Can you tell us why you can't? Quote Link to comment https://forums.phpfreaks.com/topic/192444-changing-row-order-in-mysql-using-phpmyadmin/#findComment-1014039 Share on other sites More sharing options...
jonw118 Posted February 17, 2010 Author Share Posted February 17, 2010 "Databases do not store data in any particular order, it is up to you to write your select statements in such a way the the data is retrieved in the order you want." Yeah I know it's not written/stored in a particular order, and understand it's not flat, but once the data is in there the row location doesn't change. So that's all I'm trying to do is change the order it's stored (or shown in phpMyAdmin)... because the order it is stored is the order it displays on the frontend. But as I feared and as you confirmed there's nothing I can do about that I guess. "I fail to see why. Can you tell us why you can't?" It is pulling many different modules menus loading into a centralized menu, the modules are then joined with one another and the module in question displays several different levels of navigation (which needs to be sorted). But the other modules do not need to be sorted. And it is the same statement joining all of these together. I know that sounds confusing, just the way it was written, which I've struggled to dissect and implement an effective order by. Quote Link to comment https://forums.phpfreaks.com/topic/192444-changing-row-order-in-mysql-using-phpmyadmin/#findComment-1014049 Share on other sites More sharing options...
trq Posted February 17, 2010 Share Posted February 17, 2010 I've struggled to dissect and implement an effective order by. Why not post your attempts and go from there? Quote Link to comment https://forums.phpfreaks.com/topic/192444-changing-row-order-in-mysql-using-phpmyadmin/#findComment-1014052 Share on other sites More sharing options...
jonw118 Posted February 17, 2010 Author Share Posted February 17, 2010 Yeah I guess I'll post over in the PHP Forum... my intent with posting on the MySQL forum was hoping there a solution from this angle, which there's not. But thanks much for answering my question, albeit not the answer I wanted, haha. Quote Link to comment https://forums.phpfreaks.com/topic/192444-changing-row-order-in-mysql-using-phpmyadmin/#findComment-1014055 Share on other sites More sharing options...
trq Posted February 18, 2010 Share Posted February 18, 2010 Yeah I guess I'll post over in the PHP Forum if it is a query you are having trouble with the post belongs here. Quote Link to comment https://forums.phpfreaks.com/topic/192444-changing-row-order-in-mysql-using-phpmyadmin/#findComment-1014076 Share on other sites More sharing options...
fenway Posted February 23, 2010 Share Posted February 23, 2010 You need a sortorder column -- nothing more. Quote Link to comment https://forums.phpfreaks.com/topic/192444-changing-row-order-in-mysql-using-phpmyadmin/#findComment-1016916 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.