-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.php
52 lines (46 loc) · 1.25 KB
/
db.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
<?php
function db_open(){
define("DB_SERVER","localhost");
define("DB_USER","username_here");
define("DB_PASS","pass_here");
define("DB_NAME","dbname_here");
global $mysqlilink;
$mysqlilink = mysqli_connect(DB_SERVER, DB_USER, DB_PASS, DB_NAME);
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
}
//*************************************************
// Confirms MySQL querry
//*************************************************
function confirm_query($result_set){
global $mysqlilink;
if(!$result_set){
die(mysqli_error($mysqlilink));
} }
//*************************************************
// preps entry for DB
//*************************************************
function mp( $value ) {
global $mysqlilink;
$value = mysqli_real_escape_string( $mysqlilink, $value );
return $value;
}
//************************************
// quick qu
//************************************
function qu($query){
global $mysqlilink;
$result = mysqli_query($mysqlilink, $query);
confirm_query($result);
return $result;
}
//************************************
//quick fetch
//************************************
function fa($value){
$result = mysqli_fetch_array($value, MYSQLI_BOTH);
return $result;
}
?>