public static function saveToSupplier(Supplier $spp) { $conn = cont\connection::getConnectionObject(); $con = $conn->getConnection(); $sql = $con->prepare("INSERT INTO Supplier VALUES (?,?,?,? )"); $supplierId = $spp->getSupplierId(); $name = $spp->getName(); $contactNo = $spp->getContactNo(); $Nic = $spp->getNic(); $sql->bind_param("ssss", $supplierId, $name, $contactNo, $Nic); if ($sql->execute() == TRUE) { echo "New record created successfully"; return true; } else { echo "not working"; echo "Error: " . $sql . "<br>"; return false; } }
public function saveSupplierAction() { $spp = new en\Supplier(); $spp->setSupplierId($_POST["supplierId"]); $spp->setName($_POST["name"]); $spp->setContactNo($_POST["telNo"]); $spp->setNic($_POST["NIC"]); $added = cont\SupplierDBacess::saveToSupplier($spp); if ($added) { return $this->render('applicationequipmentBundle:Forms:addedSuccessfullyMessage.html.twig'); } else { echo "not added"; return $this->render('applicationMainBundle:Default:index.html.twig'); } }