forked from thegame8714/reactquiz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbo_lib.php
86 lines (70 loc) · 1.29 KB
/
dbo_lib.php
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
// DB Config
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "quizez";
class DBO
{
var $server;
var $username;
var $password;
var $database;
var $konexioa;
var $emaitza;
var $query;
function DBO($server, $username, $password, $database)
{
$this->server=$server;
$this->username=$username;
$this->password=$password;
$this->database=$database;
if ($konexioa=mysql_connect($server, $username, $password))
if (mysql_select_db($database, $konexioa))
{
$this->konexioa=$konexioa;
return true;
}
else
{
echo "Ez da $database datubasea aurkitu.";
return false;
}
else
{
echo "Ezin izan da datubase zerbitzariarekin konektatu.";
return false;
}
}
function query($sql)
{
if($this->query=mysql_query($sql, $this->konexioa))
return true;
else
return false;
}
function emaitza()
{
$this->emaitza=mysql_fetch_array($this->query);
return $this->emaitza;
}
function itxi()
{
return mysql_close($this->konexioa);
}
function ShowError()
{
die("Error " . mysql_errno() . " : " . mysql_error());
}
function emaitza_kopurua()
{
return mysql_num_rows($this->query);
}
function hasierara()
{
if (mysql_field_seek ($this->query, 0))
return true;
else
return false;
}
}