PHP comes with intrinsic support for MySQL. A handful of functions exist for performing various database transactions. But when the number of pages containing database interactions increases,it becomes a pain to handle the connections and query processing on each page.This also affects the portability of the app since you have to make quite a lot modifications to up the app in the new server environment. So i thought of creating a class ,which besides providing some abstraction ,can be reused.By reusing the class,ease of portability may be achieved since the environment dependent area has been isolated to a singe module/class(software engineering principles,he he).
The class exports methods like connect(), selectdb(),query(),get_entry(),count_result() which are nothing but a higher level abstractions over functions like mysql_connect(),mysql_query() while the other parameters like link identifier ,result resource etc remains hidden from the user.
The result of the query(SELECT query) becomes available in the array row with field name as the key.I think the rest is all self explanatory.
The script file containing the class can be included in the required page using include() PHP function.



