Kenneth
VIP
Spam Sweeper [M:0]
Posts: 561
|
Post by Kenneth on Aug 12, 2011 3:19:00 GMT
Following this: tutorialzine.com/2010/10/ajax-web-chat-php-mysql/wediction.com/I think I have a bad DB or something because I'm not about to type anything o.O <?php
class DB { private static $instance; private $MySQLi; private function __construct(array $dbOptions){
$this->MySQLi = @ new mysqli( $dbOptions['db_host'], $dbOptions['localhost'], $dbOptions['pw'], $dbOptions['web82-sqltable'] );
if (mysqli_connect_errno()) { throw new Exception('Database error.'); }
$this->MySQLi->set_charset("utf8"); } public static function init(array $dbOptions){ if(self::$instance instanceof self){ return false; } self::$instance = new self($dbOptions); } public static function getMySQLiObject(){ return self::$instance->MySQLi; } public static function query($q){ return self::$instance->MySQLi->query($q); } public static function esc($str){ return self::$instance->MySQLi->real_escape_string(htmlspecialchars($str)); } }
?>
|
|
Bobby
Junior Poster
Welly welly welly well
Posts: 14
|
Post by Bobby on Aug 22, 2011 13:27:39 GMT
I don't see a problem with the class. How about the code invoking it?
|
|