Пример #1
0
 public function update(POI $poi)
 {
     if ($this->find($poi->getId())) {
         $pId = $poi->getId();
         $name = str_replace("'", "''", $poi->getName());
         $address = $poi->getAddress();
         $position = $poi->getPosition();
         $catId = $poi->getCategory()->getId();
         $conId = $poi->getContribution()->getId();
         $uId = $poi->getUser()->getId();
         $email = $poi->getEmail();
         $web = $poi->getWebsite();
         $phone = $poi->getPhone();
         date_default_timezone_set('Asia/Kathmandu');
         $update = date('Y-m-d H:i:s');
         $SQL = "UPDATE " . $this->TABLE_NAME . " SET\n                    name='{$name}',address='{$address}',position='{$position}',category='{$catId}',phone='{$phone}',email='{$email}',website='{$web}',\n                    update_date='{$update}',contributionId='{$conId}',userId='{$uId}'\n                    WHERE id='{$pId}'";
         if (mysql_query($SQL, $this->connection)) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }