Last change
on this file since 57 was 57, checked in by george, 16 years ago |
- Upraveno: Stránka statistika rozdělena na stránky Stav dokončení a Seznam uživatelů.
- Přidáno: Stránkování seznamu uživatelů.
- Opraveno: Přidány indexy do tabulek překladů pro sloupce Complete a Language. Díky tomu se výrazně zrychlilo zobrazení seznamu uživatelů.
|
-
Property svn:executable
set to
*
|
File size:
1.1 KB
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | class Database
|
---|
4 | {
|
---|
5 | var $id_connection = 0;
|
---|
6 |
|
---|
7 | function Database($address = 'localhost', $user = 'root', $pass = '')
|
---|
8 | {
|
---|
9 | $this->id_connection = mysql_connect($address, $user, $pass);
|
---|
10 | if(!$this->id_connection)
|
---|
11 | die('Spojení s MySQL databází se nezdařilo.');
|
---|
12 | }
|
---|
13 |
|
---|
14 | function SelectDatabase($NameDatabase)
|
---|
15 | {
|
---|
16 | $return_selection = mysql_select_db($NameDatabase, $this->id_connection);
|
---|
17 | if(!$return_selection)
|
---|
18 | die('Databázi '.$NameDatabase.' se nám nepodařilo vybrat.');
|
---|
19 | }
|
---|
20 |
|
---|
21 | function SQLCommand($Command)
|
---|
22 | {
|
---|
23 | global $Config;
|
---|
24 |
|
---|
25 | $ReturnCommand = mysql_query($Command, $this->id_connection);
|
---|
26 | if((mysql_error() != '') and ($Config['Web']['ShowSQLErrors'] = true))
|
---|
27 | echo('<div>'.mysql_error().'<br>'.$Command.'</div>');
|
---|
28 | return($ReturnCommand);
|
---|
29 | }
|
---|
30 |
|
---|
31 | function ReadFromDatabase($SQL)
|
---|
32 | {
|
---|
33 | $return_result = mysql_query($sql, $id_spojeni);
|
---|
34 | if (!$return_result)
|
---|
35 | {
|
---|
36 | die('Nepodařilo se nám načíst řádky z databáze.');
|
---|
37 | } else
|
---|
38 | {
|
---|
39 | return $return_result;
|
---|
40 | }
|
---|
41 | }
|
---|
42 |
|
---|
43 | function Disconnect()
|
---|
44 | {
|
---|
45 | mysql_close($this->id_connection);
|
---|
46 | }
|
---|
47 | }
|
---|
48 |
|
---|
49 | ?>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.