Exemplo n.º 1
0
 public static function addTown($obj_Town)
 {
     $db = config::dbconfig();
     $obj_retresult = new returnResult();
     $obj_Town->TownId = DAL_manageTown::getLastTownId() + 1;
     $sql = "INSERT INTO tbl_town (TownId,TownName,Description) \n\t\tVALUES (" . common::noSqlInject($obj_Town->TownId) . "," . "'" . common::noSqlInject($obj_Town->TownName) . "'" . "," . "'" . common::noSqlInject($obj_Town->Description) . "'" . ");";
     $rs = mysql_query($sql);
     if (mysql_affected_rows() > 0) {
         $obj_retresult->type = 1;
         $obj_retresult->msg = "success";
         $obj_retresult->data = $obj_Town;
     } else {
         $obj_retresult->type = 0;
         $obj_retresult->msg = "failed";
     }
     return $obj_retresult;
 }