March 10 2013

PHP is_serialized function

Tagged Under :

php
PHP unserialize function is use to convert an array string to an array.

But if the string not in proper array string it will return Notice error like below:
Notice: unserialize() [function.unserialize]: Error at offset 0 of 6 bytes

The easy way to fix this problem is write a function and call it “is_serialized”, use to check the string before unserialize it.

March 10 2013

Yii row number in CGridView

Tagged Under :

Yii
In Yii CGridView it doesn’t provide absolute row number in all the pages.

The easy way is write the a calculation method inside the column to show the column number.

March 10 2013

Yii rules numerical minimum or maximum display error message

Tagged Under :

Yii
Normally in Yii model rules validation to set the error message like below:
array('username', 'required', 'message'=>'username cannot blank.');

But, numerical validate method is different if you set the ‘min‘ or ‘max‘ inside the rules.

March 02 2013

PHP warning: getdate() [function.getdate]: It is not safe to rely on the system’s timezone settings

Tagged Under :

php
I face a weird problem in PHP. I just upgrade to php 5.3.0 and since the upgrade I’m getting the following warning:
Warning: getdate() [function.getdate]: It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.
And date.timezone also added. But the warning still there.