Tuesday, July 5, 2011

Find date between 2 date fields

Query to find the date exists between 2 date fields

SELECT *
FROM `hours_of_operation`
WHERE DATE( `schedule_start_date` ) <= '2011-07-06' AND DATE( `schedule_end_date` ) >= '2011-07-06'
LIMIT 0 , 30

Change the collation for a table

query to change the collation of a table.

alter table collate utf8_unicode_ci

To change the default character set and collation of a table including those of existing columns (note the convert to clause):

alter table convert to character set utf8 collate utf8_unicode_ci;

Monday, July 4, 2011

How to assign values in dropdown using jquery

This method gets all the select boxes in the view page.

$("select").each(function(key){
if($(this).attr('id')=='first_name') {
$(this).val('my_first_name');
}

});