Category Archives: Uncategorized

How to get values(via some conditions) from the MySql table without using ‘OR’?

It can be done as follows :

SELECT * FROM `table_name` WHERE `request_id` IN ('value1','value2','value3','value4');

The benefit of using IN() is that it can process data more faster than using OR condition.

How to remove one element from the last of the array?

It’s as follows :

@coins = ("Quarter","Dime","Nickel");
pop(@coins);

O/p

@coins = Dollar Quarter Dime

How to add one element at the beginning of the array?

It’s as follows :

 


@coins = ("Quarter","Dime","Nickel");
unshift(@coins, "Dollar");

O/p

3. @coins = Dollar Quarter Dime Nickel

How to add an element at the end of the array?

It’s as follows :

 


@coins = ("Quarter","Dime","Nickel");
push(@coins, "Penny");

O/p

@coins = Quarter Dime Nickel Penny

how to Select All / Deselect All options in multiple select box using java script?

It’s as follows :

 

function listbox_selectall(listID, isSelect) {
        var listbox = document.getElementById(listID);
        for(var count=0; count < listbox.options.length; count++) {
            listbox.options[count].selected = isSelect;
    }
}

 

onclick="listbox_selectall('countryList', true)" //select all the options

(or)

onclick="listbox_selectall('countryList', false)" //deselect all the options