function addCompany() { //showLog("handleLogin"); $ret = array('op' => 'addcompany', 'msg' => 'Company Added Successfully', 'error_code' => '0'); $session_dao = new DAOsession(); $session_dao->get($current_session); $dao = new DAOcompany(); $vo = new company($_SESSION["uid"], $_POST["title"], $_POST["phone"], $_POST["city"], $_POST["state"], $_POST["pin_code"], $_POST["country"], $_POST["address"]); if (isset($_POST["comp_id"])) { $vo->comp_id = $_POST["comp_id"]; } $dao->save($vo); $comp = $dao->get($_SESSION["uid"]); if ($comp == NULL) { $ret["error_code"] = "1"; $ret["msg"] = "Error Occured Or Company Not Created "; } else { $ret["comp_id"] = $comp->comp_id; } echo json_encode($ret); }
<?php include "class.company.dao.php"; include_once 'db.php'; $dao = new DAOcompany(); $vo = new company($_POST["uid"], $_POST["title"], $_POST["phone"], $_POST["country"], $_POST["address"]); $dao->save($vo); echo "Record Saved <br><br>"; echo "List of Companies With Details<br><br>"; $limit1 = 1; $limit2 = $dao->getCount(); echo "there are {$limit2} companies<br><br>"; $clist = $dao->getAll($limit1, $limit2); foreach ($clist as $co) { $co->show(); }