Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class crudpenyimpanan{
- private $mysqli;
- private $link;
- private $host = "localhost";
- private $user = "root";
- private $pass = "";
- private $selectDB = "inventory";
- private $id;
- private $nama;
- function __costruct(){
- $this->connect();
- }
- function connect(){
- $this->link = new mysqli($this->host,$this->user,$this->pass,$this->selectDB);
- if (!$this->link) {
- // jika variabel link gagal / ada kesalahan. maka,
- $this->error = "Connection Fail".$this->link->connect_error;
- return false;
- }
- }
- function insert($id,$nama){
- $insert_row = $this->link->query("INSERT INTO t_lokasi VALUES ('$id','$nama')");
- if ($insert_row) {
- echo "sukses";
- }else{
- die("Error (".$this->link->errno.") ").$this->link->error;
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment