mysql-logo

Updating two columns with a subquery in MySQL

mysql-logo

Sometimes you wanted to update columns of one MySQL table by quering another MySQL table and getting a column value from the later table. For example you have a ‘students’ table and you wanted to create a new field ‘totalMarks’ in it and wanted to fill or update by taking sum of the ‘marks’ field from another table named ‘marks’. Here comes the use of subquery to update column. Continue reading

Captcha-Component-for-CakePHP-2.x

Simple CakePHP captcha component for CakePHP 2.x

Captcha-Component-for-CakePHP-2.x

Here is the latest CakePHP Captcha component for CakePHP Version 2.x. Compatible up to CakePHP version 2.5.3.

NOTE:For best Image Captcha results this component requires GD and Freetype support enabled. Please check your phpinfo() to know whether your server supports this (See image below). Contact your hosting provider if any of these libraries is not enabled.

Continue reading

A simple way to debug a php application in production mode

Useful PHP debug functions

A simple way to debug a php application in production mode

Here are a few useful PHP debug functions.

I had a written a similar post a while ago posting the abbreviated “pr” function as a shorthand replacement for the “prinr_r” or “var_dump” functions. Since that time this function has changed a bit so re-posting it here with the improvements made. With the new updated function one can restrict the output to screen for specific IP address only. Continue reading