Friday, June 25, 2010

Hello friends! In the last section I had told you about the function called mysql_fetch_array(). Today let us see the example based on that. Suppose that a webpage is there where you are taking some inputs from user, now that input is to be shown to authorize person right? For that only we use mysql_fetch_array() function, this function fetches the value array from the database. How to use this function?

In this application you can see that names of the employee are just displayed. This a dynamic page where data is coming from database. How to do this?
Firstly you should have to write a SELECT SQL command for selecting database. After that you have to declare a variable, and store this mysql_fetch_array() in that variable. In fact you have to store the SQL command in a variable. Now, how to declare a variable in PHP? We declare variable C programming language as “int a;” here we will not declare the like this. We will just use the $ sign the name of the variable that’s it. Now, how to fetch the values from the database? For this you have to use while loop. Write a statement according to your choice, for this you have to create your own logic. Hope this much knowledge is enough. If face any problem please feel free to ask.

No comments:

Post a Comment