Articles

JSON and MySQL


We can make an adjustment to the generally accepted use of "fetch row from database and show" by using the GROUP_CONCAT function and JSON function, since we can recursively extend the JSON data this enables us to extend the data transportation mechanism without changing the code.

Multi language PHP scripting

in


Assume we have to build a multi language website; on this website are several texts which have to be translated: "home", "read more" etc. How should we solve the "translation problem" from a scripting side of view?

When building a website some code with the likes of:

echo '<a href="./read_text.php?' . $id . '"> read more </a>';

can usually be found.

If you would like to extend your website beyond the English language we have to make some adjustments there. Several options can be considered as a solution:

Simple (secure) database object

in


When using JSON as a data transport encoding schema for MySQL the database server should always return a single row; it can be useful (even better: you should) to make use of stored functions for the generation of the JSON data on the database side. A simple database object is shown and discussed.


Note:
Article is still wip.

Firstly note that we should use constants wherever possible; in this example constants are set in the constants.php file.

The object has some specific properties:

  1. public function __construct()

Manual installing of Apache PHP on Windows


When a manual install of PHP is performed on Apache windows these errors could show up:

PHP Startup: Unable to load dynamic library .... /php_mcrypt.dll
PHP Startup: Unable to load dynamic library .... /php_mysql.dll
PHP Startup: Unable to load dynamic library .... /php_mysqli.dll

The solution? Copy

libmcrypt.dll
libmysql.dll

to the /bin directory of Apache.

MySQL based PHP session handling, InnoDB or MyISAM?

in


When building a serious website you should always use a database for the session handling; this has several advantages of which session sharing between web servers [load balancing] is a key feature. Usually MySQL is the database of choice for PHP programmers, when using MySQL we can choose between two table types: InnoDB or MyISAM. Which type to choose for database session handling?

Failsafe when using JSON to load HTML data through PHP and AJAX

in


When we use JSON to load data into PHP from an external source we could run into some 'double-quote' problems when decoding the JSON string. By using a fairly simple regular expression we make sure the JSON string is still valid.

PHP Caching object for XCache or eAccelerator


Since caching should be an integral part of any (homebrew) CMS a simple static caching object is discussed for both the XCache and eAccelerator modules in PHP.

Back to top