Archive for August, 2010

Get the update timestamp of MySQL table

To get the timestamp when a table in MySQL is updated:

$sql = "SHOW TABLE STATUS WHERE name = 'table_name'";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$update_timestamp = $row['Update_time'];
$update_time = strtotime($update_timestamp);


Website: (currently down)

SACCRE Youth is the youth wing of Singapore Archdiocese Catholic Charismatic Prayer Group. The Emmaus ( is also under SACCRE Youth along with Livingstones, Amplify Ministries, Ignite, NTU CSA CPG, and many others.

Church of Holy Spirit


This is one of the first website that I designed. But the current design used by Church of Holy Spirit has been updated and is not mine anymore.

Rosary (dot) Prayer


A Catholic website about praying rosary online made with HTML, CSS, Javascript, and AJAX web technologies.

St. Philip Neri Daily Quote


Displaying quotes by St. Philip Neri and providing options to subscribe by email, Twitter, RSS, or Google Buzz daily. A counter is displayed on the bottom of the quote to let the visitor know when the next quote will be available.

The Emmaus Young Adult Catholic Charismatic Prayer Group


The name is inspired by the journey of the two disciples on the road to Emmaus where Jesus was present. The disciples, like many of us, were not aware of God’s presence in their lives. The word “Emmaus” also reminds us how the disciples’ hearts were burning as they listened to Jesus explaining the scripture passages about the Christ, and how they recognized Jesus at the breaking of the bread, and how they subsequently became very passionate to spread the Good news of their encounter with Jesus to the eleven apostles and their companions in Jerusalem.

The young adults of The Emmaus relive this experience as we pray in our weekly meeting. We also break the word of God to deepen our experience of the work of the Lord in our lives. Not only that, we try to live our “eucharist” that we celebrate every Sunday. We hope to put the Eucharist as the source and summit of our christian lives. And as our hearts burn with the fire of the Holy Spirit, we live our daily lives as God’s witnesses.

MySQL order by string percentage

There is one field in MySQL database that stores the percentage value in raw form, for example: 303.3%. When we try to use usual ORDER BY clause, the result will not be correct. The field needs to be CAST-ed first into DECIMAL. An example of the query:

SELECT * from statistics ORDER BY CAST(`percentage` AS DECIMAL)DESC LIMIT 0,20

Flying HTML table in IE

This is caused by incorrectly formed HTML markup of the table. For example if the is not properly closed, the table might appear after certain amount of blank space in the page. To fix this, make sure that every HTML element is opened and closed properly.

Checking AJAX request in Zend controller

Maybe there are certain actions in Zend that I want to be accessed only with AJAX. This snippet will work:

public function searchAction()
        // action body
        $request = $this->getRequest();
	$validate = $request->isXmlHttpRequest();
	//check if it is XMLHttpRequest / AJAX
	if ($validate)
                //Do stuff here

Microsoft outlook unusual characters

When I type three dots in Microsoft Outlook email, these characters are converted into special character and it needs special handling especially when it is stored in database and we want to retrieve and display it in web page.

function convert_raw_utf8_smart_quotes($string)
	$search = array(chr(0xe2) . chr(0x80) . chr(0x98),
	                  chr(0xe2) . chr(0x80) . chr(0x99),
	                  chr(0xe2) . chr(0x80) . chr(0x9c),
	                  chr(0xe2) . chr(0x80) . chr(0x9d),
	                  chr(0xe2) . chr(0x80) . chr(0x93),
	                  chr(0xe2) . chr(0x80) . chr(0x94),
	                  chr(0xe2) . chr(0x80) . chr(0xa6));
	$replace = array('‘',
	return str_replace($search, $replace, $string);