Project Oop
Project Oop
PROJECT IN OBJECT OR
<?php
class Database
public $conn;
public $servername="localhost";
public $username="root";
public $password="";
public $dbname="anin";
$this->conn=new mysqli($this->servername,$this->username,$this->password);
$this->conn->query($create);
$use="USE $this->dbname";
$this->conn->query($use);
var_dump($this->conn->error);
create.php
<?php
include 'db.php';
$this->init();
book_name text,
description text
)";
$this->conn->query($tbl);
var_dump($this->conn->error);
values('$bn','$d')";
$this->conn->query($in);
var_dump($this->conn->error);
return $this->conn->query($s);
$this->conn->query($d);
}
public function f_all($q)
return $all->fetch_assoc();
WHERE id='$l'";
return $this->conn->query($updatetbl);
inserts.php
<?php
include 'create.php';
$t = new Table;
$t->createTable();
$t->insert($_GET['book'],$_GET['description']);
?>
delete.php
<?php
include 'create.php';
$n = new Table;
$n->createTable();
$n->getAll();
$n->delete($_GET['id']);
header('location: formanine.php');
update.php
<?php
include 'create.php';
$update->createTable();
$names = $update->getAll();
$lists = $names->fetch_all(MYSQLI_ASSOC);
foreach($lists as $anine)
$update->updatetbl($_GET['b'],$_GET['des'],$_GET['id']);
header('location: formanine.php');
updateform.php
<?php
include 'create.php';
$up->createTable();
$j = $up->getAll();
$ls = $j->fetch_all(MYSQLI_ASSOC);
$list = $up->f_all($_GET['id']);
?>
BOOK NAME:<br>
DESCRIPTION:<br>
<input type ="hidden" name= "id" value = "<?php echo $_GET['id'] ?>">
<input type="submit" value="ENTER"><br>
<th>ID</th>
<th>Book Name</th>
<th>Description</th>
<tbody>
<tr>
</tr>
<?php }?>
</tbody>
</table>
</form>
formanine.php
<?php
include 'create.php';
$d = new Table;
$d->createTable();
$item=$d->getAll();
$f=$item->fetch_all(MYSQLI_ASSOC);
?>
BOOK NAME:<br>
<input type = "text" name = "book"><br>
DESCRIPTION:<br>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<th>id</th>
<th>book_name</th>
<th>description</th>
<th>delete</th>
<th>update</th>
<tbody>
<tr>
<td>
</td>
<td>
<td>
</td>
</tr>
<?php }?>
</tbody>
</table>
</body>
</html>