Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class mysql {
- # MySql Server
- private $host = '';
- # MySql Benutzername
- private $user = '';
- # MySql Passwort
- private $pass = '';
- # MySql Datenbank
- private $base = '';
- # Verbindung herstellen
- public function __construct($host, $user, $pass, $base) {
- # MySql Server
- $this->_host = trim($host);
- # MySql Benutzername
- $this->_user = trim($user);
- # MySql Passwort
- $this->_pass = trim($pass);
- # MySql Datenbank
- $this->_base = trim($base);
- # Verbinden ...
- $this->_connection();
- }
- public function _connection() {
- $con = @mysql_connect($this->_host, $this->_user, $this->_pass);
- $db = @mysql_select_db($this->_base, $con);
- $this->_db = $db;
- self::_checkbase();
- }
- public function _checksql($sql) {
- if($sql == true) {
- $this->_sqlerror = '';
- }
- else
- {
- $this->_sqlerror = 'Sie haben einen Fehler in einer Query! <br />'.mysql_error().__LINE__;
- }
- }
- public function _checkbase() {
- if($this->_db == true) {
- $this->_error = '';
- }
- else
- {
- $this->_error = 'Fehler in der Verbindung!';
- }
- }
- public function assoc($sqlcode = '') {
- if($sqlcode != '') {
- self::_checksql($sqlcode);
- return mysql_fetch_assoc($sqlcode);
- }
- else
- {
- return '';
- }
- }
- public function query($query) {
- self::_checksql($query);
- return mysql_query($query);
- }
- public function char($string) {
- return mysql_real_escape_string($string);
- }
- public function close_connect() {
- if ( $this->db == true ) {
- return @mysql_close($this->db);
- }
- }
- public function __destruct() {
- }
- }
- ?>
Add Comment
Please, Sign In to add comment