Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define( "MYSQL_DEBUG", true );
- // Main MySQL class
- class MySQL
- {
- var $host = "127.0.0.1";
- var $user = "root";
- var $pass = "";
- var $database = "cmb";
- var $connection;
- function OpenConnection()
- {
- $conn = mysql_connect( $this->host, $this->user, $this->pass );
- if( !$conn || !mysql_select_db( $this-database, $conn ) )
- {
- if( MYSQL_DEBUG )
- {
- die( mysql_error() );
- }
- return;
- }
- else
- {
- mysql_select_db( $this->database );
- }
- }
- function CloseConnection()
- {
- if( !empty( $this->conn ) )
- {
- mysql_close( $this->conn );
- }
- }
- function RunQuery( $sql )
- if( empty( $this->conn ) )
- {
- return;
- }
- $query = mysql_query( $sql, $this->conn );
- if( mysql_num_rows( $query ) > 1 )
- {
- if( MYSQL_DEBUG )
- {
- die( mysql_error() );
- }
- return "";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement