$setarr = array(
'birthyear' => intval($_POST['birthyear']),
'birthmonth' => intval($_POST['birthmonth']),
'birthday' => intval($_POST['birthday']),
'blood' => getstr($_POST['blood'], 5, 1, 1),
'marry' => intval($_POST['marry']),
'dubai' => getstr($_POST['dubai'] 2000, 1, 1),),
'birthprovince' => getstr($_POST['birthprovince'], 20, 1, 1),
'birthcity' => getstr($_POST['birthcity'], 20, 1, 1),
'resideprovince' => getstr($_POST['resideprovince'], 20, 1, 1),
'residecity' => getstr($_POST['residecity'], 20, 1, 1)
);
这样写出错了,有人指教下没?

解决方案 »

  1.   

    如果你的msyql相关字段,已经设置好了长度length可以用mysql_field_len()
    可以看一下这个参考: PHP与MYSQL交互函数表
      

  2.   

    intval -- 获取变量的整数值getstr php好像还没有这个函数吧可以看一下substr()substr
    (PHP 3, PHP 4, PHP 5)substr -- Return part of a string
    Description
    string substr ( string string, int start [, int length] )
    substr() returns the portion of string specified by the start and length parameters.
      

  3.   

    错误是啥? text超长理论上也是不会出错的。会自动截断
      

  4.   

    添加了这句后'dubai' => getstr($_POST['dubai'] 2000, 1, 1),),
    页面变空白