+   Reply to Thread

Hi,

In class Rain_Form on the line
 if( !in_array( $validation,
explode(',','required,remote,minlenght,maxlength,rangelength,min,max,range,email,
url,date,dateISO,dateDE,number,numberDE,digits,creditcard,accept,equalTo') ) )


i think minlenght is write wrong.. it need to be minlength .. after i change this my condiction in form is working

$this->form_obj->add_validation('firstname','minlength=3','Firstname is too short. Min size is 3 chars.');
Also in function

private function _text( $name, $value, $param, $type='text' ){
   $attributes = '';
   if( is_array( $param ) )
    foreach( $param as $attr => $val )
     $attributes .= $attr == 'disabled' ? ' disabled' : " $attr=\"$val\"";
   return "<input type=\"$type\" name=\"$name\" value=\"$value\" class=\"text\" />";
  }


it need to return $attributes so the last line need to be

return "<input type=\"$type\" name=\"$name\" value=\"$value\" class=\"text\" $attributes/>
Hey Adnan,

we fixed this bug, thanks for reporting it. You are welcome to follow the project and contribute on github, https://github.com/rainphp/rainframework.

Thanks
In class db.php

replace old function with these ..


static function insert( $table, $data ){
   if( count( $data ) ){
    $fields = $values = "";
     foreach( $data as $name => $value ){
      $fields .= $fields ? ",`$name`" : "`$name`";
      if(is_numeric($value)){
       $values .= $values ? ",$value" : "$value";
      }else{
       $values .= $values ? ",'$value'" : "'$value'";
      }
      
     }
    return self::$link->query( "INSERT INTO $table ($fields) VALUES ($values)" );
   }
  }


The old function is not working because it generate sql string like these
INSERT INTO `tbl` (`id`,`name`) VALUES (`1`,`DD`)

but i need to be

INSERT INTO `tbl` (`id`,`name`) VALUES ('1','DD')

difrence is in the qute in the VALUES '

Also I add new function is_numeric to check is input number to best generate sql input string like

INSERT INTO `tbl` (`id`,`name`) VALUES (1,'DD')

Rain,

I will pull git tonight and every other error i will commit to the git .. :)

Thank you for this framework it is very nice :)

+   Reply to Thread



Profiler output