If I manage to Insert Infomation to medicine table .....the Information go without insert into DateBase Addmedicine.php
<?phpinclude_once("../Include/connectionstring.php");include_once("../Repositories/Medicine.repo.php");if(isset($_POST['btnsubmit'], $_POST['Id_Medicine'], $_POST['Medicine_name'], $_POST['Medicine_Level'])) { $Idmedicine=intval($_POST['Id_Medicine']); $MedicineName=strval($_POST['Medicine_name']); $MedicineLevel=intval($_POST['Medicine_Level']); $AddMedicine= new MedicineRepo(); $affectedRows=$AddMedicine->AddMedicine($MedicineName,$MedicineLevel); $isDone = $affectedRows == 1; if($isDone==TRUE) $message="Operation Succeeded!"; else $message="Operation Failed";}else$Message="ALL FIELD ARE REQUIRED";echo $Message;?> Medicine.repo.php<?phpinclude_once("../include/connectionstring.php");class MedicineRepo{function GetMedicine(){ $dbh=DBClass::GetConnectionString(); $sql="select * from medicine"; $stmt=$dbh->prepare($sql); $stmt->setFetchMode(PDO::Fetchclass,'Medicine'); $stmt->execute(); return $stmt->fetchAll(); } function AddMedicine($MedicineName,$MedicineLevel) { $dbh=DBClass::GetConnectionString(); $sql="insert into medicine(Medicine_name,Medicine_Level)values(:MedicineName,:MedicineLevel)"; $stmt=$dbh->prepare($sql); $stmt->bindparm(':MedicineName',$MedicineName,PDO::PARAM_STR); $stmt->bindparm(':MedicineLevel',$MedicineLevel,PDO::PARAM_INT); $stmt->execute(); return $stmt->rowcount(); } function DeleteMedicine($IdMedicine){ $dbh=DBClass::GetConnectionString(); $sql="delete from Medicine where Id_Medicine=:IdMedicine"; $stmt=$dbh->prepare($sql); $stmt->bindparm(':IdMedicine',$IdMedicine,PDO::PARM_INT); $stmt->execute();} }?>
AddMedicine.php
Medicine.repo.php