Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
[RESOLVED] MySQLi Issue
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Reecers" data-source="post: 452581" data-attributes="member: 78364"><p>I used this and got [ATTACH=full]9488[/ATTACH]</p><p></p><p>Also following is the class.engine</p><p>[CODE=php]<?php</p><p></p><p>namespace Revolution;</p><p>if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); }</p><p>class engine</p><p>{</p><p> private $initiated;</p><p> private $connected;</p><p> </p><p> private $connection;</p><p> </p><p> </p><p> final public function Initiate()</p><p> {</p><p> global $_CONFIG;</p><p> if(!$this->initiated)</p><p> {</p><p> $this->setMySQL('connect', mysql_connect);</p><p> $this->setMySQL('pconnect', mysql_pconnect);</p><p> $this->setMysql('select_db', mysql_select_db);</p><p> $this->setMySQL('query', mysql_query);</p><p> $this->setMySQL('num_rows', mysql_num_rows);</p><p> $this->setMySQL('fetch_assoc', mysql_fetch_assoc);</p><p> $this->setMySQL('fetch_array',mysql_fetch_array);</p><p> $this->setMySQL('result', mysql_result);</p><p> $this->setMySQL('free_result', mysql_free_result);</p><p> $this->setMySQL('escape_string', mysql_real_escape_string);</p><p> </p><p> $this->initiated = true;</p><p> </p><p> $this->connect($_CONFIG['mysql']['connection_type']);</p><p> }</p><p> }</p><p> </p><p> final public function setMySQL($key, $value)</p><p> {</p><p> $this->mysql[$key] = $value;</p><p> }</p><p> </p><p> </p><p> /*-------------------------------Manage Connection-------------------------------------*/</p><p> </p><p> final public function connect($type)</p><p> {</p><p> global $core, $_CONFIG;</p><p> if(!$this->connected)</p><p> {</p><p> $this->connection = mysqli_connect($_CONFIG['mysql']['hostname'], $_CONFIG['mysql']['username'], $_CONFIG['mysql']['password'], $_CONFIG['mysql']['database']);</p><p></p><p> </p><p> if($this->connection)</p><p> {</p><p> $mydatabase = $this->mysql['select_db']($_CONFIG['mysql']['database'], $this->connection);</p><p> </p><p> if($mydatabase)</p><p> {</p><p> $this->connected = true; </p><p> }</p><p> else</p><p> {</p><p> $core->systemError('MariaDB Engine', mysql_error());</p><p> }</p><p> }</p><p> else</p><p> {</p><p> $core->systemError('MariaDB Engine', mysql_error()); </p><p> }</p><p> }</p><p> }</p><p> </p><p> final public function disconnect()</p><p> {</p><p> global $core;</p><p> if($this->connected)</p><p> {</p><p> if($this->mysql['close'])</p><p> {</p><p> $this->connected = false;</p><p> }</p><p> else</p><p> {</p><p> $core->systemError('MySQL Engine', 'MySQL could not disconnect.');</p><p> }</p><p> }</p><p> }</p><p> </p><p> /*-------------------------------Secure MySQL variables-------------------------------------*/</p><p> </p><p> final public function secure($var)</p><p> {</p><p> return $this->mysql['escape_string'](stripslashes(htmlspecialchars($var)));</p><p> }</p><p> </p><p> /*-------------------------------Manage MySQL queries-------------------------------------*/</p><p> </p><p> final public function query($sql)</p><p> {</p><p> return $this->mysql['query']($sql, $this->connection) or die(mysql_error());</p><p> }</p><p> </p><p> final public function num_rows($sql)</p><p> {</p><p> return $this->mysql['num_rows']($this->mysql['query']($sql, $this->connection));</p><p> }</p><p> </p><p> final public function result($sql)</p><p> {</p><p> return $this->mysql['result']($this->mysql['query']($sql, $this->connection), 0);</p><p> }</p><p> </p><p> final public function free_result($sql)</p><p> {</p><p> return $this->mysql['free_result']($sql);</p><p> }</p><p> </p><p> final public function fetch_array($sql)</p><p> {</p><p> $query = $this->mysql['query']($sql, $this->connection);</p><p> </p><p> $data = array();</p><p> </p><p> while($row = $this->mysql['fetch_array']($query))</p><p> {</p><p> $data[] = $row;</p><p> }</p><p> </p><p> return $data;</p><p> }</p><p> </p><p> final public function fetch_assoc($sql)</p><p> {</p><p> return $this->mysql['fetch_assoc']($this->mysql['query']($sql, $this->connection));</p><p> }</p><p></p><p></p><p></p><p></p><p>}</p><p>?>[/CODE]</p></blockquote><p></p>
[QUOTE="Reecers, post: 452581, member: 78364"] I used this and got [ATTACH=full]9488[/ATTACH] Also following is the class.engine [CODE=php]<?php namespace Revolution; if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); } class engine { private $initiated; private $connected; private $connection; final public function Initiate() { global $_CONFIG; if(!$this->initiated) { $this->setMySQL('connect', mysql_connect); $this->setMySQL('pconnect', mysql_pconnect); $this->setMysql('select_db', mysql_select_db); $this->setMySQL('query', mysql_query); $this->setMySQL('num_rows', mysql_num_rows); $this->setMySQL('fetch_assoc', mysql_fetch_assoc); $this->setMySQL('fetch_array',mysql_fetch_array); $this->setMySQL('result', mysql_result); $this->setMySQL('free_result', mysql_free_result); $this->setMySQL('escape_string', mysql_real_escape_string); $this->initiated = true; $this->connect($_CONFIG['mysql']['connection_type']); } } final public function setMySQL($key, $value) { $this->mysql[$key] = $value; } /*-------------------------------Manage Connection-------------------------------------*/ final public function connect($type) { global $core, $_CONFIG; if(!$this->connected) { $this->connection = mysqli_connect($_CONFIG['mysql']['hostname'], $_CONFIG['mysql']['username'], $_CONFIG['mysql']['password'], $_CONFIG['mysql']['database']); if($this->connection) { $mydatabase = $this->mysql['select_db']($_CONFIG['mysql']['database'], $this->connection); if($mydatabase) { $this->connected = true; } else { $core->systemError('MariaDB Engine', mysql_error()); } } else { $core->systemError('MariaDB Engine', mysql_error()); } } } final public function disconnect() { global $core; if($this->connected) { if($this->mysql['close']) { $this->connected = false; } else { $core->systemError('MySQL Engine', 'MySQL could not disconnect.'); } } } /*-------------------------------Secure MySQL variables-------------------------------------*/ final public function secure($var) { return $this->mysql['escape_string'](stripslashes(htmlspecialchars($var))); } /*-------------------------------Manage MySQL queries-------------------------------------*/ final public function query($sql) { return $this->mysql['query']($sql, $this->connection) or die(mysql_error()); } final public function num_rows($sql) { return $this->mysql['num_rows']($this->mysql['query']($sql, $this->connection)); } final public function result($sql) { return $this->mysql['result']($this->mysql['query']($sql, $this->connection), 0); } final public function free_result($sql) { return $this->mysql['free_result']($sql); } final public function fetch_array($sql) { $query = $this->mysql['query']($sql, $this->connection); $data = array(); while($row = $this->mysql['fetch_array']($query)) { $data[] = $row; } return $data; } final public function fetch_assoc($sql) { return $this->mysql['fetch_assoc']($this->mysql['query']($sql, $this->connection)); } } ?>[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
[RESOLVED] MySQLi Issue
Top