Class Name:database
Description:database abstraction class to connect to the mysql database and to simplify sql queries.
Constructor:
Database($hostname,$username,$password,$dbName);
This constructor sets the values of these variables
Methods:
Connect()
Opens a connection to the database, selects a database and returns a connection ID.
Query($sql)
This function executes sql query. It takes sql query as its parameter and returns a resource ID
Num_rows()
This function returns no of rows returned by the sql query
Movenext()
This method returns an object with properties of the fetched row
Getfield()
This function returns value of the field corresponding to that record
Pre-requisite for using the class:
Php and mysql should be installed
Url of the class:
http://kiran/dbClass/example.php
for usage of the class, please refer to source code of example.php file.
|