-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathoesdb.php
38 lines (30 loc) · 845 Bytes
/
oesdb.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
<?php
/*
***************************************************
*** Online Examination System ***
*** Title: Database Library Functions ***
***************************************************
*/
include_once 'dbsettings.php';
$conn=false;
function executeQuery($query)
{
global $conn,$dbserver,$dbname,$dbpassword,$dbusername;
global $message;
if (!($conn = @mysql_connect ($dbserver,$dbusername,$dbpassword)))
$message="Cannot connect to server";
if (!@mysql_select_db ($dbname, $conn))
$message="Cannot select database";
$result=mysql_query($query,$conn);
if(!$result)
$message="Error while executing query.<br/>Mysql Error: ".mysql_error();
else
return $result;
}
function closedb()
{
global $conn;
if(!$conn)
mysql_close($conn);
}
?>