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.
Posted by
chevrons in
PHP
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.
Posted by
chevrons in
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.
Posted by
chevrons in
Yii
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.
Posted by
chevrons in
PHP
Because I want integrate my web application with one of the famous payment gateway. But they didn’t provide any API and just give the documentation only.
So I write the code myself to communicate the payment gateway server.
Posted by
chevrons in
PHP
Few day ago I install PHPUnit3.7 on my PC. and I follow
phpunit.de instruction install on my PC.
So far everything working properly. But when I try run it on Yii, it pop out an alert message “CLI has stopped working”.
How to using jQuery search the array key or check for a key exists in an array.
Since JavaScript doesn’t really have associative arrays, then we only write a function to check.
Use a short code to get a value from the database the easy way is using Ajax.
But the short code and value are fixed, we keep it in database is for future reuse it.
So I use another way to get the value. That is an array. use array key find the value.
Use jQuery remove white space to avoid user escape required field.
There is one of the functions from jQuery which help to solve this problem.
Because want use jQuery get the input box value but the input box without the id attribute.
Then need use name attribute to find the input box get the value.