-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.php
29 lines (22 loc) · 784 Bytes
/
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
<?php
function db_connect(){
$db_host = "localhost";
$db_user = "root";
$db_pass = "";
$db_name = "tree_life_shop";
return mysqli_connect($db_host, $db_user, $db_pass, $db_name);
}
$get_company_query = "SELECT * FROM company";
$company_query_result = mysqli_query(db_connect(), $get_company_query);
$result = mysqli_fetch_assoc($company_query_result);
$_SESSION['company'] = array(
'name' => $result['name'],
'image_dark' => $result['image_dark'],
'image_light' => $result['image_light'],
'phone' => $result['phone']
);
function get_all($table_name){
$get_query = "SELECT * FROM $table_name";
return mysqli_query(db_connect(), $get_query);
}
?>