11Tami Posted April 23, 2007 Share Posted April 23, 2007 Hello, is there a way to make mysql server sort its fields? Like if I wanted the fields to appear by alphabet of the name instead of just which one was entered first. Please let me know if you can sort these fields, I looked everywhere can't see how to do it, yet other databases can sort. Please let me know, thank you very much. Quote Link to comment https://forums.phpfreaks.com/topic/48256-can-php-mysql-server-sort/ Share on other sites More sharing options...
MadTechie Posted April 23, 2007 Share Posted April 23, 2007 Erm you mean " Order By " something else? can you show some sample code please Quote Link to comment https://forums.phpfreaks.com/topic/48256-can-php-mysql-server-sort/#findComment-235877 Share on other sites More sharing options...
11Tami Posted April 23, 2007 Author Share Posted April 23, 2007 Thanks, first there is the whole database, then the tables. Then all the fields in each table. The fields in the table is what I need sorted. So right now I have many fields in one table. The first field is listed as "name." With other fields after it. When I click on browse to look at all the rows that have been entered, the rows are not listed alphabetically. Instead they are listed by which row was entered first and last. Another way to explain it. There are forms on the web pages. Each person comes along and enters their information. It is sent to the database. Each entry for each person appears as a row in the fields. So I have all these rows being added. But they are being with the last one being added at the end. Instead of alphabetical by what their name is. Fields, first field is name [name] [information] Rows [Tami] [Tamisinfo] [grey] [betty] [bettyinfo] [blue] I'd like it to be alphabetical by name, so that Betty would come before Tami. Not Betty last just because she entered her stuff in after Tami. Either sorted alphatically automatically when they are added. Or sorted when I come along later and hit a button to sort everything. Hope someone knows a way. Thank you very much. Quote Link to comment https://forums.phpfreaks.com/topic/48256-can-php-mysql-server-sort/#findComment-235892 Share on other sites More sharing options...
MadTechie Posted April 23, 2007 Share Posted April 23, 2007 SO in the SQL statement use something like SELECT * FROM table1 ORDER BY field1, field2 Quote Link to comment https://forums.phpfreaks.com/topic/48256-can-php-mysql-server-sort/#findComment-235894 Share on other sites More sharing options...
Crusader Posted April 23, 2007 Share Posted April 23, 2007 "SELECT field FROM table ORDER BY field DESC" I might have wrote that backwards so if it outputs the wrong try ASC instead of DESC. Quote Link to comment https://forums.phpfreaks.com/topic/48256-can-php-mysql-server-sort/#findComment-235895 Share on other sites More sharing options...
11Tami Posted April 23, 2007 Author Share Posted April 23, 2007 Thanks, so you can't sort the fields? You can only pull them out of the database alphabetically? Quote Link to comment https://forums.phpfreaks.com/topic/48256-can-php-mysql-server-sort/#findComment-235899 Share on other sites More sharing options...
MadTechie Posted April 23, 2007 Share Posted April 23, 2007 What! each time you pull a record you can print the fields to the screen in any order you wish! i think your need to provide some code as what your saying sounds a little weird maybe SELECT name, infomation, color, etc FROM tabel1 will work!! Quote Link to comment https://forums.phpfreaks.com/topic/48256-can-php-mysql-server-sort/#findComment-235903 Share on other sites More sharing options...
11Tami Posted April 23, 2007 Author Share Posted April 23, 2007 What I mean is, are you saying there is no button in the database itself anywhere? A button that you can push that says "sort by" like other databases have? I don't know what your code means or what to do with it. Quote Link to comment https://forums.phpfreaks.com/topic/48256-can-php-mysql-server-sort/#findComment-235914 Share on other sites More sharing options...
MadTechie Posted April 23, 2007 Share Posted April 23, 2007 OK first off, the "Button" the "Programmer" creates, this then executes a command to which tells the server to sort the records the command is "SELECT * FROM table1 ORDER BY field1, field2" (with options filled in). this is MySQL not FileMaker Quote Link to comment https://forums.phpfreaks.com/topic/48256-can-php-mysql-server-sort/#findComment-235916 Share on other sites More sharing options...
11Tami Posted April 23, 2007 Author Share Posted April 23, 2007 Ok thanks, where do I put your code? Quote Link to comment https://forums.phpfreaks.com/topic/48256-can-php-mysql-server-sort/#findComment-235920 Share on other sites More sharing options...
MadTechie Posted April 23, 2007 Share Posted April 23, 2007 its an example, just update your SQL statement, or post your SQL statement Quote Link to comment https://forums.phpfreaks.com/topic/48256-can-php-mysql-server-sort/#findComment-235923 Share on other sites More sharing options...
11Tami Posted April 23, 2007 Author Share Posted April 23, 2007 You should be able to tell I don't know what I'm doing. You mean the statement on the page? Or do I insert it at the database? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/48256-can-php-mysql-server-sort/#findComment-235952 Share on other sites More sharing options...
MadTechie Posted April 23, 2007 Share Posted April 23, 2007 please post your code (in the code tags) please Quote Link to comment https://forums.phpfreaks.com/topic/48256-can-php-mysql-server-sort/#findComment-235955 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.