Month: May 2009

How to import data into mysql db from sql file

Open your shell prompt

navigate to the mysql directory (default is /var/lib/mysql)
cd /pathToYourMysqlDirectory/

then type the below command

$ mysql -u mysqlUserName -p Password -h HostName DatabaseName < /loactionOfYourSqlFile/yourSqlFileName.sql

Where
mysqlUserName = Mysql User Name
Password = Mysql User Password
HostName = Mysql Host Name (This could be local host or some remote IP where you want to import the database)
DatabaseName = Mysql Database Name
/loactionOfYourSqlFile/yourSqlFileName.sql = This is the location of your sql file

Note : This is work only in Linux system

Thanks

How to copy file from local machine to remote server in linux

scp fileName userName@remoteServerIP:remoteServerFolderPath

Example :
>scp abc.txt root@XXX.XXX.XXX.XXX:/home/xyzFolder/

once you type this command, system will ask for the remote server login password.once password is verified , file get copied to remote server.

check whether any of the checkbox are checked or not

function isChecked(url)
{
f=document.frmName
var checkFound = false;
for (var counter=0; counter < f.length; counter++)
{
if ((f.elements[counter].name == ‘checkBoxId[]’) && (f.elements[counter].checked == true))
{
checkFound = true;
}
}
if (checkFound != true)
{
alert(‘Please check at least one checkbox.’);
return false;
}
else
{
//do something
}

}

Check or uncheck multiple checkbox at a time in javascript

function checkUncheckAllCheckbox()
{
f=document.frmName
if(f.mainCheckBox.checked)
{
f.checkBoxName.checked=true;
for(i=0;i<f.checkBoxName.length;i++)
f.checkBoxName[i].checked=true;
}
else if(!f.mainCheckBox.checked)
{
f.checkBoxName.checked=false;
for(i=0;i<f.checkBoxName.length;i++)
f.checkBoxName[i].checked=false;
}
}