CSV (“Comma Separated Values”) is a format commonly used to import and export tabular data from spreadsheets, databases and other applications.
This post gives some examples of how to handle this format in a PHP script
CSV (“Comma Separated Values”) is a format commonly used to import and export tabular data from spreadsheets, databases and other applications.
This post gives some examples of how to handle this format in a PHP script
The preg_match function in PHP can be used to find, inside a string, those substrings that match a pattern specified by means of a regular expression.
But the default behaviour of preg_match is not to match a substring that spans more than one line.
This post explains the procedure to follow to load the records in a MySQL table as documents of a collection in the solr search engine, by means of a PHP script that uses the Solarium library.
In our previous posts about solr we have already covered the installation and configuration of this search engine. In this post we will give an overview of the Solarium library. This library makes it easy querying, updating, and managing a solr database from a PHP script. Continue reading »
Sometimes, the structure of the content of a web site need to be modified, causing the URLs used to access some of the pages in the site to be changed.
But other web sites might already have created links to our site, using the old URLs. Besides, some users might have bookmarked the old URLs in their browsers. Finally, search engines such as Google or Bing might already have indexed the content of our site using the old URLs.
To prevent all those valuable references to become broken links, we can program the site to redirect users, as well as search engines, to the new URLs, when requests for the old URLs are received.
Many web sites offer dynamic content that results from the execution of a script, in many cases written in PHP. Every time the web server receives a request, the script that generates the HTML code returned to the client runs,often performing several database queries, or any other type of processing that might be expensive in time and resource usage, resulting in a slow response time and poor user experience.
This post explains the implementation of a cache mechanism that may alleviate this problem: The HTML code resulting from the execution of the script is saved to disk, and every time a new request is received for the same page, this pre-processed content is served directly from the disk cache, thus avoiding the need to execute again the whole process.
The base functionality of the WordPress CMS (Content Management System) can be expanded developing themes and plugins that get “hooked” at different points of the process performed by WordPress to serve incoming requests.
The functionality of a given plugin may require adding tables to the database, or performing queries to the existing tables, in a non-standard way that cannot be carried out with the functions available in the base WordPress distribution.
WordPress provides a “wpdb” class that can be used to execute any kind of query against the database, to retrieve or modify data stored in it.
This post explains how to work with the $wpdb object.
The functionality offered by Berkeley DB has already been introduced in previous posts in this series, and sample use cases in Perl and Java have been presented. This post explains how to work with databases of this type in a PHP script.
Sometimes, a program need to process binary data. This post explains how to handle binary data in a PHP script for the most common processing needs.
This post lists several options for the handling of warning and error messages that can be thrown during the execution of a CGI script written in PHP.