Set - 7

Question 6 :

HOW CAN WE TAKE A BACKUP OF A MYSQL TABLE AND HOW CAN WE RESTORE IT? 

Answer :

Answer 1:
Create a full backup of your database: shell> mysqldump tab=/path/to/some/dir opt db_name
Or: shell> mysqlhotcopy db_name /path/to/some/dir
The full backup file is just a set of SQL statements, so restoring it is very easy: 

shell> mysql "."Executed";
Answer 2:
To backup: BACKUP TABLE tbl_name TO /path/to/backup/directory
' To restore: RESTORE TABLE tbl_name FROM /path/to/backup/directory

mysqldump: Dumping Table Structure and Data 
Utility to dump a database or a collection of database for backup or for transferring the data to another SQL server (not necessarily a MySQL server). The dump will contain SQL statements to create the table and/or populate the table.
-t, no-create-info
Don't write table creation information (the CREATE TABLE statement).
-d, no-data
Don't write any row information for the table. This is very useful if you just want to get a dump of the structure for a table!


Question 7 :

How to set cookies? 

Answer :

setcookie('variable','value','time'); 
variable - name of the cookie variable
value - value of the cookie variable
time - expiry time
Example: setcookie('Test',$i,time()+3600);

Test - cookie variable name
$i - value of the variable 'Test'
time()+3600 - denotes that the cookie will expire after an one hour


Question 8 :

How to reset/destroy a cookie ?

Answer :

Reset a cookie by specifying expire time in the past:
Example: setcookie('Test',$i,time()-3600); // already expired time 

Reset a cookie by specifying its name only
Example: setcookie('Test');


Question 9 :

What types of images that PHP supports ? 

Answer :

Using imagetypes() function to find out what types of images are supported in your PHP engine. 
imagetypes() - Returns the image types supported.
This function returns a bit-field corresponding to the image formats supported by the version of GD linked into PHP. The following bits are returned, IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM.


Question 10 :

Check if a variable is an integer in JAVASCRIPT ?

Answer :

var myValue =9.8;
if(parseInt(myValue)== myValue)
alert('Integer');
else
alert('Not an integer');