Welcome Guest, Not a member yet? Register   Sign In
Updating a unique field in database (example: account username or email)
#10

[eluser]Salvatore Formisano[/eluser]
wow, so basically this would be the final result?

Code:
function unique_update($str,$field)
    {
        $CI =& get_instance();
        list($table, $column) = split("\.", $field, 2);
        $CI->form_validation->set_message('unique', 'The %s that you requested is unavailable.');
        $query = $CI->db->query("SELECT COUNT(*) dupe FROM $table WHERE $column = ‘$str’ AND id != $CI->input->post('fieldname');;");
        $row = $query->row();
        return ($row->dupe > 0) ? FALSE : TRUE;
    }


Messages In This Thread
Updating a unique field in database (example: account username or email) - by El Forum - 12-11-2009, 01:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB