$stmt = $user_home->runQuery("SELECT * FROM users WHERE id=:uid"); $stmt->execute(array(":uid" => $_SESSION['userSession'])); $row = $stmt->fetch(PDO::FETCH_ASSOC); $code = ""; $supname = ""; $supnic = ""; $apptearate = ""; $suppkgs = ""; $totincome = ""; $paid = ""; $remainbalance = ""; $formateddate = date('Y-m-d'); if (isset($_POST['search'])) { $code = $_POST['code']; if ($dbupdates->checkSupplierExist($code) == true) { $supname = $dbupdates->getSupplierName($code); $supnic = $dbupdates->getMyNIC($code); $apptearate = $dbupdates->thisMonthTeaRate(); $kgs1 = $dbupdates->getTodayMySupply($code); $kgs2 = $dbupdates->myTotalSupplyOfaMonth($code, $formateddate); $pay1 = $dbupdates->thisMonthPayForMe($code); $pay2 = $dbupdates->todayPayForMe($code); $suppkgs = $kgs1 * 1 + $kgs2 * 1; $pay = $pay1 * 1 + $pay2 * 1; $totincome = $suppkgs * $apptearate; $paid = $pay; $remainbalance = $totincome - $pay; } else { $code = "Supplier Doesn't exist!"; } }