Ejemplo n.º 1
0
function updatePlants($sessionkey, $appcode, $Plantsdata)
{
    $main_result = "<VPROFILERESULT>";
    $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>";
    $userId = ValidateSession($sessionkey, $appcode);
    if ($userId > -1) {
        $main_result = "<AUTHSTATUS>1</AUTHSTATUS>";
        $obj_Plants = new Plants();
        foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) {
            switch ($key) {
                case "PLANTID":
                    $obj_Plants->PlantId = $child;
                    break;
                case "NAME":
                    $obj_Plants->Name = $child;
                    break;
                case "DESCRIPTION":
                    $obj_Plants->Description = $child;
                    break;
                case "BIONAME":
                    $obj_Plants->BioName = $child;
                    break;
            }
        }
        $obj_retResult_Plants = DAL_managePlants::updatePlants($obj_Plants);
        if ($obj_retResult_Plants->type == 1) {
            $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>";
            $main_result .= getPlantsXml($obj_retResult_Plants->data);
        } else {
            $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>";
        }
    }
    $main_result .= "</VPROFILERESULT>";
    return $main_result;
}
Ejemplo n.º 2
0
 public static function addPlants($obj_Plants)
 {
     $db = config::dbconfig();
     $obj_retresult = new returnResult();
     $obj_Plants->PlantId = DAL_managePlants::getLastPlantsId() + 1;
     $sql = "INSERT INTO tbl_plants (PlantId,Name,Description,BioName) \n\t\tVALUES (" . common::noSqlInject($obj_Plants->PlantId) . "," . "'" . common::noSqlInject($obj_Plants->Name) . "'" . "," . "'" . common::noSqlInject($obj_Plants->Description) . "'" . "," . "'" . common::noSqlInject($obj_Plants->BioName) . "'" . ");";
     $rs = mysql_query($sql);
     if (mysql_affected_rows() > 0) {
         $obj_retresult->type = 1;
         $obj_retresult->msg = "success";
         $obj_retresult->data = $obj_Plants;
     } else {
         $obj_retresult->type = 0;
         $obj_retresult->msg = "failed";
     }
     return $obj_retresult;
 }