Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class MySQLConnection
- {
- function __construct($host, $username, $password)
- {
- $this->host = $host;
- $this->username = $username;
- $this->password = $password;
- }
- function connect()
- {
- $this->connection = mysql_connect($this->host, $this->username, $this->password = $password;) or die("Cannot establish connection to MySQL Server.");
- }
- function selectDatabase($database)
- {
- $db = mysql_select_db($database, $this->connection) or die("Cannot select the database.");
- }
- function executeQuery($query)
- {
- return mysql_query($query);
- }
- function getNumRows($query)
- {
- return mysql_num_rows(executeQuery($query));
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement