Categories
Most commented
-
Recent Posts
Recent Comments
-
Archive for the Category: PHP
From MySQL to HTML with PHP and XML
In my post "From MySQL to XML with PHP", I described how to generate XML from the MySQL database. Instead of printing out XML, generated XML can be buffered and transformed with XSL to the HTML. Maybe it sounds complicated for a simple process of displaying MySQL data on the WEB page. But if you set a WEB architecture this way, you will have a separated presentation layer from the database and business logic.
Write to a log file with PHP
As you certainly know, PHP can be used for command line scripting too. In my case, I caught myself writing log PHP function many times so I finally decided to write Logging PHP class. After Logging class initialization, first call of lwrite method will open log file for writing. If lclose method is not called at the end, then log file will be closed implicitly.
From MySQL to XML with PHP
PHP XML generator can be written in less then 100 lines. In this example, data from the MySQL database are converted to the XML. PHP function sql2xml has optional second parameter to describe the XML hierarchy, while first parameter is SQL query. Second parameter is string in form of integers separated by commas.
PHP Web server monitor
With this simple PHP script, you'll be able to monitor the availability of Web servers. Write a list of URLs to monitor and run the script from cron. If a site becomes unavailable, monitor PHP script will generate alert and send e-mail to the default e-mail address. Monitor script is also able to send e-mail message to the various e-mail address (e-mail address per URL).
Resize images with PHP script
Did you ever try to resize many images at once? I did, and I wrote PHP script for that purpose. Anyway, after I selected few images from my photo album, I realized that every image was about 500KB and resolution of 1600x1200. This seems too big. Images should be smaller and lighter for upload.