MYSQL MODIFY column to NULL

March 17, 2014

Some newer version of phpmyadmin by default when create field name not allow NULL. after added the field, we can use MODIFY command to change it default null. Mysql MODIFY command example:

jQuery get checkbox value

March 12, 2014

You can I get a checkbox’s value in jQuery like this if you have set a class or id for it Without id For some reason: •$(‘#checkbox’).val() always returns on •$(‘#checkbox’).is(‘checked’) always returns false But, Returns the right checkbox state. Other way of retrieving checkbox’s value is

jQuery remove validation rules by event

March 12, 2014

You could use the rules(‘remove’) method to remove your rules dynamically. Something like this on any event. Use rules(‘add’) method to add the rules back just before submit example:

How to convert php array to javascript array

March 11, 2014

You can convert php arrays into javascript using php’s json_encode()* function: Example: To use the array, remember do JSON.parse(): To use the array, jquery $.each is easy to loop and retrieve the information:

fuelphp HMVC pass in some data

March 7, 2014

At first I have some problem with fuel HMVC Request behaviour. Problem is with passing data to HMVC controller method. Fuelphp documentation has mention about pass in some data, however, did not mentioned about pass in big array: http://fuelphp.com/docs/general/hmvc.html I found that it is pretty easy if you has a big array to pass to […]

jQuery find thead element of a table

March 5, 2014

Use .find() Hide a thead element after found: Remove a thead element after found

jQuery datepicker to show month and year only

February 21, 2014

In reporting specially, datepicker with month and year only are a better way to provide information to form for submission without need of the day. In my case, I modified one picker $( “#month” ).datepicker to fill both month and year input field

php mktime you should be using the time function instead

February 20, 2014

As of PHP 5.1, when called with no arguments, mktime() throws an E_STRICT notice: use the time() function instead Reference: http://php.net/manual/en/function.mktime.php

PHP get next month first day and remaining days to this date

February 20, 2014

Below method is tweaked to take account of December. This method is leap-year safe. The day count must include floor(). From above mktime calculation, not only get the number of days, we can count the hours and minutes till next month first day. Example:

php in_array check for multiple values

February 19, 2014

It depend on how many values to check using in_array. If more than two, better way is loops through array and runs an in_array of it on the checking array. Returns true once something is found, else it returns false. If only two, probably can use if: Reference: http://stackoverflow.com/questions/7542694/in-array-multiple-values