1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
|
class mysql_init
{
function mysql_init($dbhost, $dbname, $dbuser, $dbpass)
{
$this->connection = @mysql_connect($dbhost, $dbuser, $dbpass);
$this->connection OR $this->error(1);
$this->database = @mysql_select_db($dbname, $this->connection);
$this->database OR $this->error(2);
}
function query($string)
{
$this->sql = $string;
$this->result = @mysql_query($this->sql) OR $this->error(0);
return $this->result;
}
function error($errmsg = 0)
{
if (!is_numeric($errmsg)) {
$error = $errmsg;
} else {
switch ($errmsg) {
case 0:
$error = "<b>PGMS MySQL-Datenbank Error:</b> ".mysql_error()."";
break;
case 1:
$error = "<b>PGMS MySQL-Datenbank Error:</b> Es konnte keine Verbindung zur Datenbank hergestellt werden";
break;
case 2:
$error = "<b>PGMS MySQL-Datenbank Error:</b> Die Datenbank konnte nicht ausgewählt werden";
break;
}
}
$error .= "<br><a href=\"http://domain.de/faq.php&topic=mysql\" target=\"_blank\">Zu den FAQs von Professional Gaming Management System</a>";
die($error);
}
function fetch()
{
$fetchone=@mysql_fetch_array($this->result) OR $this->error(0);
print $fetchone;
}
function numRows($result)
{
print @mysql_num_rows($this->result);
} |