Thursday, May 5, 2011

PHP Interview Questions 1-6


PHP INTERVIEW QUESTIONS


  1. What are the differences between Get and post methods in form submitting, give the case where we can use get and we can use post methods?

    Ans:

    using get method is not secure, ur informations will be appeared in the url address. using post method is much secure it will not appear in the url address. eg.secure for using post method in login form.


    Get-> we can transfer limited data and its not secure. (256char)
    post-> we can transfer unlimited data. ans its a secure.

  2. Who is the father of PHP and explain the changes in PHP versions?

    Ans:


    Father - Rasmus lerdorf

    Released php versions - > 1997 – php3, 1998 – php4 , 2004 – php5

  3. How can we submit a form without a submit button?

    You can attach the document.formname.submit() method to onclick,onchange events of different inputs and perform the form submission.

  4. In how many ways we can retrieve the date in the result set of mysql using PHP?

  • mysql_fetch_array - Fetch a result row as an associative array, a numeric array, or both

  • mysql_fetch_assoc - Fetch a result row as an associative array

  • mysql_fetch_object - Fetch a result row as an object

  • mysql_fetch_row —- Get a result row as an enumerated array


  1. What is the difference between mysql_fetch_object and mysql_fetch_array?

    Mysql_fetch_object returns the result from the database as objects while mysql_fetch_array returns result as an array. This will allow access to the data by the field names.

    mysql_fetch_object: Results are objects returned from database. Fields are accessible like
    $result->name, $result->cust_name, where $result is the result object and name, cust_name are the fields.
    mysql_fetch_array : Results are arrays returned from database. Fields are accessible like
    $result[name], $result[cust_name].

  2. What is the difference between $message and $$message?

    $message – php variable

    $$message – Reference variable.

No comments:

Post a Comment