Welcome Guest, Not a member yet? Register   Sign In
Get max_lenght of numeric field
#1

HI , this is my function :

PHP Code:
        $finfo $this->db->getFieldData($tabella_db);


    
    foreach ($finfo as $val) {

    
         if($val->type == 'varchar'  OR  $val->type == 'text' ){

               $lunghezza =$val->max_length;

               fwrite($fp"trim|min_length[0]|max_length[$lunghezza]");

             }

            } 

How can i do the same on numeric field (tinyint,smallint etc.)
Reply
#2

For a numeric field, the limit is a maximum value, it's not a maximum number of digits. Use the rules 'less_than_equal_to' with the maximum value for a tinyint (127), smallint (32767), etc.
See this page for a list of all the rules: http://codeigniter.com/user_guide/librar...able-rules
Reply




Theme © iAndrew 2016 - Forum software by © MyBB