Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class database {
- private $host = "";
- private $user = "";
- private $password = "";
- private $database = "";
- function __construct() {
- $conn = $this->connectDB();
- if(!empty($conn)) {
- $this->selectDB($conn);
- }
- }
- function connectDB() {
- $conn = new mysqli("", "", "", "");
- return $conn;
- }
- function selectDB($conn) {
- new mysql_select_db($this->database,$conn);
- }
- function runQuery($query) {
- $result = mysql_query($query);
- while($row=mysql_fetch_assoc($result)) {
- $resultset[] = $row;
- }
- if(!empty($resultset))
- return $resultset;
- }
- function numRows($query) {
- $result = mysql_query($query);
- $rowcount = mysql_num_rows($result);
- return $rowcount;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement