PHP
Which mode of MySQL WEEK() complies with ISO 8601 and matches PHP’s DATE function
To mix MySQL week numbers with PHP, can be a bit confusing. The best way to get a relevant match is to use mode 3 in the MySQL WEEK() function. For example, in PHP: [php] date(‘W’, strtotime(‘2019-12-31’)); Returns: 01 date(‘W’, strtotime(‘2020-12-31’)); Returns: 53 date(‘W’, strtotime(‘2021-12-31’)); Returns: 52 [/php] The same in MySQL: [sql] SELECT WEEK(‘2019-12-31’,…
SugarCRM / SuiteCRM – Adding created_by and modified_user_id using SugarBean
If you are a big fan of using SugarBean to handle CRUD (Create Read Update Delete) operations, you might have noticed that the created_by and modified_user_id values are automatically provided by the underlying code logic. You can bypass this logic and override the UserIDs. Below is the example PHP code: [php] $bean->set_created_by = false; $bean->update_modified_by =…
Install, Configure & Optimise PHP5 with PHP5-FPM
PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites. Source : PHP-FPM Website PHP-FPM is far better than the standard mod_php implementation of PHP and also easier to implement that spawn-fcgi. PHP-FPM works like an application that loads and kills PHP…
PHP : Convert or Cast Array to Object & Object to Array
I love PHP Objects. Given an option of returning any data as an Array or Object, I would go for Objects. PHP Objects are clean and easy to write. Now to the conversion (casting) of a PHP Array into a PHP Object.
Codeigniter Country Drop Down List Form Helper
Firstly, I create a helper and name it as MY_form_helper.php. This file will go into the application/helpers directory. I have extended the Form Helper as I will be using the country drop down select box in my forms.