Пример #1
0
 function uniquetest($args)
 {
     /*
      * function checks that a given value is unique in the table
      * 
      * we need to do a SELECT on $args['unique'] to count how many have the value of $_POST[$args['Field']]...
      * 
      * @param $args
      * @return void
      */
     include_once 'app/core/storage.class.php';
     // no... storage class will be included, constructed, and globalized in index.php...
     $storage = new storage();
     $ary = array('tbl' => $args['unique'], 'col' => $args['Field'], 'val' => $_POST[$args['Field']]);
     //die(print_r($ary));
     //global $STORAGE;
     if ($storage->recordIsUnique($ary) != 0) {
         $result = 'error_answer_exists';
         $this->seterror($args['Field'], $result);
     }
 }