;

PDA

Click to See Complete Forum and Search --> : Sorting data from a text file using php


thesween
07-05-2008, 05:48 PM
Hello,

I can make a guest book using km and a php file, which writes info to a text file. I use the following to load the data into a dynamic text box(you've probably seen it before)..

Ecran = "loading entries ...";
var gbend = 1;
gbpage = 1;
vr1 = 0;
vr2 = "No";
this.loadVariables("/shoutbox/shoutbox.php?vr1="+vr1+"&vr2="+vr2+"&R="+random(999));
stop();

Does anyone know of a way of using the same method of retrieving data but loading it all in a particular order?..

For example, if the movie records the age and name into a text file.. then the movie loads the info in age order, oldest at the top of the list.

Hope that makes sense..

Thanks again in advance..

blanius
07-05-2008, 10:26 PM
Using LoadVars instead you can access the Raw data loaded with onData and using the string function split to get each line into an array, you can then sort the array. This is a trick I learned from Wilburt.

Here's a good thread where it's explained.
http://board.flashkit.com/board/showthread.php?t=753298

thesween
07-14-2008, 06:58 PM
Thanks Bret, I think I can get my head around this! Cheers!