-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbclass.php
44 lines (40 loc) · 1.09 KB
/
dbclass.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
<?php
include('connection.php');
class db{
public $conn;
function __construct(){
$this->conn=mysqli_connect("localhost","root","");
if(mysqli_connect_errno()){
echo "failed to connect";
mysqli_connect_error();
exit();
}
mysqli_select_db($this->conn,"azure");
}
public function getUser($uname,$pwd){
$sql="SELECT user_id,u_name,password from user where u_name='$uname' and password='$pwd' LIMIT 1";
$result=mysqli_query($this->conn,$sql);
return $result;
}
public function getUserData(){
//session_start();
$sql="SELECT u_name,name,phone,email,radio from user where user_id = ".$_SESSION['uid']."";
$result=mysqli_query($this->conn,$sql);
return $result;
}
public function getOrder(){
$sql="SELECT * from job_table where user_id=".$_SESSION['uid']."";
$result=mysqli_query($this->conn,$sql);
return $result;
}
public function logOut(){
unset($_SESSION["uid"]);
//echo "<script>location.href='index.php'</script>";
header("location:index.php");
exit;
}
function __destruct(){
mysqli_close($this->conn);
}
}
?>