djanim8 Posted August 6, 2007 Share Posted August 6, 2007 Lets see if I can explain this right.... I have a table with each row containing times.. so colA = 12:00 PM, colE = 2:00 PM, colM = 12:30 PM and I have these displayed in a printable php page: 12:00 PM - start this 2:00 PM - do this thing sub do this thing: yes 12:30 PM - later thing what I'd like to do, is figure out a way to SORT them so that it looks like this: 12:00 PM - start this 12:30 PM - later thing 2:00 PM - do this thing sub do this thing: yes I thought about putting each timed thing into a different record, but that would be way to confusing since each timed event has sub events... and the table is already created so is there a way I could gather all the information, then sort it by the time Quote Link to comment https://forums.phpfreaks.com/topic/63561-heres-a-good-one-on-sorting-by-time/ Share on other sites More sharing options...
effigy Posted August 6, 2007 Share Posted August 6, 2007 The time is in a column by itself? Quote Link to comment https://forums.phpfreaks.com/topic/63561-heres-a-good-one-on-sorting-by-time/#findComment-316754 Share on other sites More sharing options...
djanim8 Posted August 6, 2007 Author Share Posted August 6, 2007 yes it is... I was thinking a multideminsional array.. but not sure how complicated that will get. Quote Link to comment https://forums.phpfreaks.com/topic/63561-heres-a-good-one-on-sorting-by-time/#findComment-316877 Share on other sites More sharing options...
effigy Posted August 6, 2007 Share Posted August 6, 2007 If you're pulling it out of a database, why can't you use ORDER BY? Quote Link to comment https://forums.phpfreaks.com/topic/63561-heres-a-good-one-on-sorting-by-time/#findComment-316887 Share on other sites More sharing options...
GingerRobot Posted August 6, 2007 Share Posted August 6, 2007 Effigy: isn't the point that it is the fields that contain all the differant times in one record, rather than there being lots of records containing each differant time? Of course, its not the best way to store data...but thats how i've understood the question. djanim8: Yeah, i would go with a multidimensional array. I dont suppose anyone can give you any sample code without more information. Where does the "start this" and "later thing" come from? Perhaps you could post you existing code? Quote Link to comment https://forums.phpfreaks.com/topic/63561-heres-a-good-one-on-sorting-by-time/#findComment-316889 Share on other sites More sharing options...
effigy Posted August 6, 2007 Share Posted August 6, 2007 Effigy: isn't the point that it is the fields that contain all the differant times in one record, rather than there being lots of records containing each differant time? Of course, its not the best way to store data...but thats how i've understood the question. I see. What I'm getting at is, why is the database set up this way, rather than do such and such. Quote Link to comment https://forums.phpfreaks.com/topic/63561-heres-a-good-one-on-sorting-by-time/#findComment-316907 Share on other sites More sharing options...
djanim8 Posted August 6, 2007 Author Share Posted August 6, 2007 the database is set up that way because it would take to much (there is tons of info for this one) to enter a record for each one.. long story.. I've never sorted an array before.. whats the code for that? Quote Link to comment https://forums.phpfreaks.com/topic/63561-heres-a-good-one-on-sorting-by-time/#findComment-316947 Share on other sites More sharing options...
Barand Posted August 6, 2007 Share Posted August 6, 2007 sort() rsort() asort() arsort() ksort() krsort() usort() uasort() Apologies for any I forgot http://www.php.net/manual/en/ref.array.php Quote Link to comment https://forums.phpfreaks.com/topic/63561-heres-a-good-one-on-sorting-by-time/#findComment-317035 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.