时间:2021-07-01 10:21:17 帮助过:26人阅读
1 //====================================================================往表中增加数据vote_answer为表名
2 /*
3 $ins_vote_answer = new voteAnswer();//往vote_answer表中插入数据
4 $ins_vote_answer['id'] = 3;
5 $ins_vote_answer['member_id'] = 1;
6 $ins_vote_answer['vote_question_id'] = 1;
7 $ins_vote_answer['vote_question_option_id'] = 1;
8 $ins_vote_answer['body'] = 1;
9 $ins_vote_answer['created_at'] = 1;
10 $ins_vote_answer['updated_at'] = 1;
11 $ins_vote_answer->save();
12 */
13
14 //====================================================================查询数据
15 /*
16 // $id = 1;
17 // $member_id = 1;
18 // $que_voteAnswer = Doctrine::getTable('voteAnswer')->createQuery()->select('id,member_id')->where('id=?',$id)->andWhere('member_id=?',$member_id)->orderBy('id')->groupBy('id');//====查询方法一表名vote_answer
19 // $que_voteAnswer = Doctrine_Query::create()->select('id,member_id')->from('voteAnswer')->where('id = 2')->andWhere('member_id = 1')->orderBy('id')->groupBy('id');//====查询方法二
20 // $row_voteAnswer = $que_voteAnswer->fetchOne();//不管执行几次此方法只获取结果集第一条记录
21 // //$row_voteAnswers = $que_voteAnswer->execute();//和下面的fetchArray()方法基本等同,都需要沥遍
22 // //$row_voteAnswers = $que_voteAnswer->fetchArray();
23 // //foreach($row_voteAnswers as $row_voteAnswer){
24 // $this->a = $row_voteAnswer['id'];
25 // /