Re: [PHP] need help with foreach

2006-10-31 Thread Dave Hamber
Its not very clear what you want to achieve with that code snippet. If you are pulling database rows out of your database with mysql_fetch_array(), then you do not need a foreach loop. I think you may want something like this, but without knowing your database table structure and the query yo

Re: [PHP] Run script every 30 seconds

2006-10-30 Thread Dave Hamber
You could run the script as a daemon. man daemon. The sloppy way of running the script every 30 seconds would be to use sleep(30), but that would cause the script to run at 30 seconds + execution time. If you make a loop like this you could get around that: $t=time()+31; while(true){

Re: [PHP] Run script every 30 seconds

2006-10-30 Thread Dave Hamber
Sorry, slight adjustment, make that $t=time()-31; in the first line so that the script runs immediately. > You could run the script as a daemon. man daemon. > > The sloppy way of running the script every 30 seconds would be to use sleep(30), but that would cause the script to run at 30 seconds

Re: [PHP] natsort()

2006-10-26 Thread Dave Hamber
natsort() places the array elements in natural order but not the keys. If you want your elements printed using "print" in a loop either reorganise the keys first or use "foreach". The easiest method would be to use: foreach($dl as $filename){ print $filename; } If you insist on using