Tuesday, January 20, 2009

PHP Interview Question

  1. How can I maintain the count of how many persons have hit my site?

  • Create a text file to store the no of value of user hit.
  • At the first time the file count variable is 0 then every time when the form is load and user click on that form at that time we open the file and increment the counter variable.
  • Then close the file in this way we can find that how many time the the page is hitted by the user
  • The best way is to use session variables. So that whenever a user hits web-page, we can increment the counter in the session variable set for number of users.
  • In your database maintain separate table visitor detail, for example you have user_detail table filed is count_user in your index file put on the particular code: mysql_query("update user_detail set count _visitor+1"); Whenever index file opened so that query will execute


  1. What is difference between mysql_fetch_array(), mysql_fetch_row() and mysql_fetch_object()?
  • mysql_fetch_array():- Fetch a result row as an associative array, a numeric array, or both by default it fetches both.

  • mysql_fetch_row() :- Get a result row as an numeric array.

  • mysql_fetch_object :- Fetch a result row as an object.


  1. How I can make a chat page in php in simple
  • Create a .txt file.
  • Open it in write mode then write something in message box that will write in that file.
  • Another user also open that file and write the file with the message box.
  • Also open the file in read mod in side window to see what the other user is written.
  • By this way we can make simple chat file with php.


  1. How I can get IP address of the usr?

1 comment:

  1. You description on PHP was quite clear and easily understandable. Thanks for your post.

    ReplyDelete