Go to: http://www.icosmoss.com/ and you see this project tracker (New Source Codes). What I want to do is automate this updater with PHP. It should display the 5 newest files by grabbing their date in the database table.
It should sort the result by date; the latest comes to the top.
How can I do this? Thanks
------------------ Matthias Hagemann - matt@icosmoss.com
Need some source code? icosmoss.com - The Open Source Community
I dont know much PHP But this is the logic of your problem.
A. change your SQL statement to have this "ORDER BY DATE" after the where clause. That will display them in the order you wish.
B. to only grab 5 unless PHP has a specific function to do that do it like you'd do a for while loop. Make a counter variable and do a check and see if its less than or equal to 5, if it is you display one result, add 1 to counter, start at top etc.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote/font><HR>Originally posted by aspen: I dont know much PHP But this is the logic of your problem.
A. change your SQL statement to have this "ORDER BY DATE" after the where clause. That will display them in the order you wish.
Chris<HR></BLOCKQUOTE>
I n the ORDER BY date statement the latest is at the bottom, I would like to have it turned around.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote/font><HR>Originally posted by antti: That should work. So, the problem might be that (just guessing):
1) It doesn't find the file
-> check web server's error log
-> try putting the full path to the .pl file
2) You are using php in safe mode (safe_mode=On)
-> then you can only run programs in the safe_mode_exec_dir
-> check that with phpinfo()<HR></BLOCKQUOTE>
1)
-> nothing is shown at that place
-> still doesn't work
2)
-> that's a little too high-level Can you give me some code for this? Thanks.
safe_mode_exec_dir description (from the PHP manual):
"If PHP is used in safe mode, system() and the other functions executing system programs refuse to start programs that are not in this directory."
The script itself runs well, since I had it in the .shtml version. The only problem is that it doesn't run with the .php3 extension. I got a hint to look at this page: http://www.php.net/manual/function.virtual.php
Currently I can't check it because my DSL connection isn't working so I can't upload the modified file to test it. I'll keep you updated...
Bookmarks