Skip to content

Commit 2d0c0e4

Browse files
Create connection.php
1 parent 2c61b8e commit 2d0c0e4

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

dist/connection.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
namespace codeboxsql;
3+
4+
class connection
5+
{
6+
protected $connect;
7+
protected $db_host;
8+
protected $db_user;
9+
protected $db_pass;
10+
protected $db_database;
11+
12+
public function __construct($host, $user, $pass, $database)
13+
{
14+
$this->db_host = $host;
15+
$this->db_user = $user;
16+
$this->db_pass = $pass;
17+
$this->db_database = $database;
18+
$this->connect = mysqli_connect($this->db_host, $this->db_user, $this->db_pass, $this->db_database);
19+
}
20+
public function query_execute($sql)
21+
{
22+
return mysqli_query($this->connect, $sql);
23+
}
24+
public function query_rowCount($sql)
25+
{
26+
return mysqli_num_rows($sql);
27+
}
28+
public function query_lastID()
29+
{
30+
return mysqli_insert_id($this->connect);
31+
}
32+
33+
}

0 commit comments

Comments
 (0)