/ Published in: PHP
Just a beginning, hoping to refine this ASAP.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /* * Author: Alvin Crespo * Date: 2/19/2010 * * Database Manager * * */ class dbmanager{ private $db_link; private $hostname = 'localhost'; private $username = 'username'; private $password = 'password'; private $dbname; function __construct($dbname){ $this->dbname = $dbname; $this->db_connect(); } function db_connect(){ $this->db_link = new mysqli($this->hostname, $this->username, $this->password, $this->dbname); } function db_query($query){ $result = $this->db_link->query($query); while($row = $result->fetch_array(MYSQLI_ASSOC)){ $rows[] = $row; } return $rows; } }