Sunday, September 23, 2007

php questions and answers

28. How can we increase the execution time of a PHP script?

A: We can increase the execution time using set_time_limit(int) in php.ini file.

Default is 30 sec. 0 is unlimited

29. How can we take a backup of a mysql table and how can we restore it. ?

A: BACKUP TABLE tbl_name[,tbl_nam..] TO ‘/path/to/backup/directory’

RESTORE TABLE tbl_name[,tbl_name] FROM ‘/path/to/backup/directory’

30. How can we optimize or increase the speed of a mysql select query?

A: We will give first preference for non complex query

We will give second preference for complex query

31. How many ways can we get the value of current session id?

A: session_id();

32. How can we destroy the session, how can we unset the variable of a session?

A: session_unregister - Unregister a global variable from the current session

session_unset - Free all session variables

33. How can we destroy the cookie?

A: Set past time

Set cookie(‘username’,’sankar’, time()-60);

34. How many ways we can pass the variable through the navigation between the pages?

A: 3 ways,

GET, POST, REQUEST

35. What is the difference between ereg_replace() and eregi_replace()?

No comments: