Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- Class MySQL
- {
- // Connection of the mysql api
- Private $Connection ;
- // Database information
- Private $Hostname ;
- Private $Username ;
- Private $Password ;
- Private $Database ;
- // Last handle of query
- Private $HandleOfLastQuery ;
- // Methods to set and get the hostname
- Public Function GetHostname ( )
- {
- Return $this->Hostname ;
- }
- Public Function SetHostname ( $Hostname )
- {
- $this->Hostname = $Hostname ;
- }
- // Methods to set and get the username
- Public Function GetUsername ( )
- {
- Return $this->Username ;
- }
- Public Function SetUsername ( $Username )
- {
- $this->Username = $Username ;
- }
- // Methods to set and get the password
- Public Function GetPassword ( )
- {
- Return $this->Password ;
- }
- Public Function SetPassword ( $Password )
- {
- $this->Password = $Password ;
- }
- // Methods to set and get the database
- Public Function GetDatabase ( )
- {
- Return $this->Database ;
- }
- Public Function SetDatabase ( $Database )
- {
- $this->Database = $Database ;
- }
- // Method to initialize and connect to the
- // mysql server and database
- Public Function Initialize ( )
- {
- $this->Connection = MySQL_Connect ( $this->Hostname , $this->Username , $this->Password ) ;
- MySQL_Select_DB ( $this->Database , $this->Connection ) ;
- }
- // Method to finalize and close the
- // mysql server and database connection
- Public Function Finalize ( )
- {
- MySQL_Close ( $this->Connection ) ;
- }
- // Method to send a query to the
- // mysql server and database
- Public Function Query ( $Query )
- {
- $this->HandleOfLastQuery = MySQL_Query ( $Query , $this->Connection ) ;
- }
- // Method to fetch an object
- Public Function Fetch ( )
- {
- Return MySQL_Fetch_Object ( $this->HandleOfLastQuery ) ;
- }
- // Method to get the row
- Public Function GetRow ( )
- {
- Return $this->HandleOfLastQuery ;
- }
- // Method to get the number of rows
- Public Function GetNumberOfRows ( )
- {
- Return MySQL_Num_Rows ( $this->HandleOfLastQuery ) ;
- }
- } ;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement