Exemplo n.º 1
0
/**
 * Print test head
 * @param null $title
 */
function test_head($title = null)
{
    if ($title) {
        echo Strings::nl() . strings::strtoupper($title) . Strings::nl();
    }
    echo str_repeat('-', 50) . Strings::nl();
}
Exemplo n.º 2
0
 /**
  * Check field unique 
  * Makes query to db for each check
  * @return bool
  */
 function check_unique_field($name, $value, $uid = false)
 {
     if (empty($value)) {
         return false;
     }
     $vf = $this->get_valid_field($name);
     $is_text = $vf['type'] == 'text';
     if ($is_text) {
         $value = strings::strtoupper($value);
     }
     $value = $this->format_field_sql($name, $value);
     $where_ = $uid ? "id <> " . (int) $uid . " AND " : '';
     $sql = "SELECT id FROM " . $this->get_table() . " WHERE " . $where_ . ($is_text ? "UCASE({$name})" : $name) . " " . ($is_text ? '=' : '=') . " {$value}";
     return 0 == $this->db->sql_numrows($this->db->sql_query($sql));
 }