1.How can we find the number of rows in a table using MySQL?
Ans: Use this for mysql
>SELECT COUNT(*) FROM table_name;
2.How can we find the number of rows in a result set using PHP?
Ans: $result = mysql_query($sql, $db_link);
$num_rows = mysql_num_rows($result);
echo "$num_rows rows found";
3.How many ways we can we find the current date using MySQL?
Ans: SELECT CURDATE();
CURRENT_DATE() = CURDATE()
for time use
SELECT CURTIME();
CURRENT_TIME() = CURTIME()
4.How can we find the number of rows in a result set using PHP?
Ans: Here is how can you find the number of rows in a result set in PHP:
$result = mysql_query($any_valid_sql, $database_link);
$num_rows = mysql_num_rows($result);
echo “$num_rows rows found”
5.What types of images that PHP supports ?
Ans: 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
6.What Is a Persistent Cookie?
Ans: A persistent cookie is a cookie which is stored in a cookie file permanently on the browser's computer. By default, cookies are created as temporary cookies which stored only in the browser's memory. When the browser is closed, temporary cookies will be erased. You should decide when to use temporary cookies and when to use persistent cookies based on their differences:
1.Temporary cookies can not be used for tracking long-term information.
2.Persistent cookies can be used for tracking long-term information.
3.Temporary cookies are safer because no programs other than the browser can access them.
4.Persistent cookies are less secure because users can open cookie files see the cookie values.
7.What does a special set of tags <?= and ?> do in PHP?
Ans: The output is displayed directly to the browser.
8.What is the difference between mysql_fetch_object and mysql_fetch_array?
Ans: MySQL fetch object will collect first single matching record where mysql_fetch_array will collect all matching records from the table in an array
9.How can I execute a PHP script using command line?
Ans: Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. For example, "php myScript.php", assuming "php" is the command to invoke the CLI program.
Be aware that if your PHP script was written for the Web CGI interface, it may not execute properly in command line environment.
10.I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?
Ans: PHP Interpreter treats numbers beginning with 0 as octal. Look at the similar PHP interview questions for more numeric problems.
Ans: Use this for mysql
>SELECT COUNT(*) FROM table_name;
2.How can we find the number of rows in a result set using PHP?
Ans: $result = mysql_query($sql, $db_link);
$num_rows = mysql_num_rows($result);
echo "$num_rows rows found";
3.How many ways we can we find the current date using MySQL?
Ans: SELECT CURDATE();
CURRENT_DATE() = CURDATE()
for time use
SELECT CURTIME();
CURRENT_TIME() = CURTIME()
4.How can we find the number of rows in a result set using PHP?
Ans: Here is how can you find the number of rows in a result set in PHP:
$result = mysql_query($any_valid_sql, $database_link);
$num_rows = mysql_num_rows($result);
echo “$num_rows rows found”
5.What types of images that PHP supports ?
Ans: 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
6.What Is a Persistent Cookie?
Ans: A persistent cookie is a cookie which is stored in a cookie file permanently on the browser's computer. By default, cookies are created as temporary cookies which stored only in the browser's memory. When the browser is closed, temporary cookies will be erased. You should decide when to use temporary cookies and when to use persistent cookies based on their differences:
1.Temporary cookies can not be used for tracking long-term information.
2.Persistent cookies can be used for tracking long-term information.
3.Temporary cookies are safer because no programs other than the browser can access them.
4.Persistent cookies are less secure because users can open cookie files see the cookie values.
7.What does a special set of tags <?= and ?> do in PHP?
Ans: The output is displayed directly to the browser.
8.What is the difference between mysql_fetch_object and mysql_fetch_array?
Ans: MySQL fetch object will collect first single matching record where mysql_fetch_array will collect all matching records from the table in an array
9.How can I execute a PHP script using command line?
Ans: Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. For example, "php myScript.php", assuming "php" is the command to invoke the CLI program.
Be aware that if your PHP script was written for the Web CGI interface, it may not execute properly in command line environment.
10.I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?
Ans: PHP Interpreter treats numbers beginning with 0 as octal. Look at the similar PHP interview questions for more numeric problems.
Previous | Next |
:: Click the links below for similar type Questions and answers ::
4 comments:
thanks for sharing this articles codeigniter interview questions
Nice collection of PHP interview questions. Looking ahead for few more questions and answers.
Amazing post, I concur with you 100%! I'm continually scouring the Internet for new data and realizing whatever I can, and in doing as such I at times leave remarks on web journals. Website Design Company Bangalore | Website Development Company Bangalore
Corephp interview questions and answers for freshers and 1 to 5 years experience candidate.Learn tips and tricks for cracking php interview questions .Coding tag will guide you the best e-learning website that cover all technical and learn technical tutorial based on different languages.
Post a Comment