reenadak icon

Validation function

reenadak | PRO | 03/24/18 08:15:09 PM UTC | 0 ⭐ | 433 👁️ | Never ⏰ | []
PHP |

1.07 KB

|

None

|

0 👍

/

0 👎

function val_md_day($col,$val,$row, $instanceName)
{
    // Delete image file if it already existed
    $query = "select md_day from ess where md_day = :md_day";
    $queryParams = array('md_day' => $val);
    $stmt = $this->Editor->doQuery($query,$queryParams);
    if($row = $stmt->fetch(PDO::FETCH_ASSOC))
    {
        // Create custom validation message and return false
        $this->Editor->showDefaultValidationMsg = false;
        $this->Editor->addTooltipMsg('There exist a record with date ' . $val . ' so it can not be added but edited. ' );
        return false;
    }
    else
    {
      return true;
    }
}
 
 
// validate function if value already exist
    function checkDomain($col,$val,$row)
      {
        $query = "select domain from ".TBL_MAIN." where domain = '$val'";
        $result = mysql_query($query);
 
          if (mysql_num_rows($result) == 0)
          {
            return $val;
          }
          else
          {
            $this->Editor->retArr[] = array('where' => 'javascript', 'value' => 'alert("Sorry this dance name already exists in the db");');
            return false;
          }
      }

Comments