-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDB.php
46 lines (31 loc) · 893 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
$dbServer="localhost";
$dbUser="root";
$dbPass="";
$dbName = "db_message";
$conn = @mysqli_connect($dbServer , $dbUser , $dbPass , $dbName);
//$this->database = @mysqli_connect($dbhost,$account,$password, $dbName);
if(mysqli_connect_errno($conn)) //if error
die("Unconnected");
mysqli_set_charset($conn,"utf-8"); //set the character
////////////////////////////////////////////////////class
class Message{
var $name;
var $time;
var $content;
var $ID;
function __construct($id,$n , $t , $c){
$this->ID = $id;
$this->name = $n;
$this->time = $t;
$this->content = $c;
}
function show(){
echo "ID: ".$this->ID."<br>";
echo "Name: ".$this->name."<br>";
echo "Time: ".$this->time."<br>";
echo "Content: ".$this->content."<br>";
echo "====================<br>";
}
}
?>