【初学者】关于多表插入问题求教!

浏览:1134 发布日期:2013/02/22 分类:求助交流 关键字: ThinkPHP多表插入
数据同时写入两个表FormAction.class.php
$Form = D('Form');
        $Double    =    D('Double');
        if ($Form->create() && $Double->create()){
            $result    =    $Form->add();
            $results    =    $Double->add();
            if ($result && $results){
                $this->success('操作成功!');
            }else {
                $this->error('操作失败!');
            }
        }else {
            $this->error($Form->getError());
        }
FormModel.class.php
class FormModel extends Model{
    // 定义自动验证
    protected $_validate    =   array(
        array('title','require','标题必须'),
        );
    // 定义自动完成
    protected $_auto    =   array(
        array('create_time','time',1,'function'),        
        array('create_time','time',1,'function'),
        );
}
结果是think_form里面的create_time有值,而think_double表的create_time为空,菜鸟请教中...
最佳答案
评论( 相关
后面还有条评论,点击查看>>