Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,688 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,291 people online right now. Registration is fast and FREE... Join Now!




email sorting?

 
Reply to this topicStart new topic

email sorting?

mdzitter
post 27 May, 2008 - 05:49 PM
Post #1


New D.I.C Head

*
Joined: 27 May, 2008
Posts: 1

I am in need of some sort of script or combination of scripts which takes emails received from a listserve, sorts them into categories based on keywords, phrases, or original senders, and then format and display them on a web page.

Now I know that PHP can retrieve the sorted emails from a database and place them on a page, but the sorting is throwing me for a loop, what would I use to do that?

Any direction would be appreciated

MZ
User is offlineProfile CardPM

Go to the top of the page

Martyr2
post 27 May, 2008 - 06:54 PM
Post #2


Programming Theoretician

Group Icon
Joined: 18 Apr, 2007
Posts: 5,062



Thanked 177 times

Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions


Well the type of sorting is going to depend on the way the information is structured and how you fetched it from the database. For instance, if each email is made into an array and that array is in another array of emails, then you can use functions like asort(), rsort(), ksort(), natsort() etc.

If you fetched these items as objects from the database, stored them in a custom object that you made and put those into an array, you may want to take a look at the usort() function which will allow you to create a comparator function in which you define how the two objects will be compared and used for sorting. In this function you would most likely compare various values of fields in the object to determine which takes priority like by sorting on the email's headers or if it has more attachments than the other.

So a good start would be to check out these functions I have mentioned here in the PHP manual at PHP.net and check out the examples. Then you can go from there.

If you need help with this some more, just show us what the structure of each email looks like, how you fetch it from the database and how you store it before needing to sort. Then we can GUIDE you as to what approach might work best for you.

Good luck. smile.gif
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 07:31AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month