Home > Database > Mysql Tutorial > Doctrine单表操作_MySQL

Doctrine单表操作_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:50:57
Original
954 people have browsed it

bitsCN.com

 1 //====================================================================往表中增加数据vote_answer为表名<br> 2 /*<br> 3     $ins_vote_answer = new voteAnswer();//往vote_answer表中插入数据<br> 4     $ins_vote_answer['id'] = 3;<br> 5     $ins_vote_answer['member_id'] = 1;<br> 6     $ins_vote_answer['vote_question_id'] = 1;<br> 7     $ins_vote_answer['vote_question_option_id'] = 1;<br> 8     $ins_vote_answer['body'] = 1;<br> 9     $ins_vote_answer['created_at'] = 1;<br>10     $ins_vote_answer['updated_at'] = 1;<br>11     $ins_vote_answer->save();<br>12 */<br>13 <br>14 //====================================================================查询数据<br>15 /*<br>16 //    $id = 1;<br>17 //    $member_id = 1;<br>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<br>19 //    $que_voteAnswer = Doctrine_Query::create()->select('id,member_id')->from('voteAnswer')->where('id = 2')->andWhere('member_id = 1')->orderBy('id')->groupBy('id');//====查询方法二<br>20 //    $row_voteAnswer = $que_voteAnswer->fetchOne();//不管执行几次此方法只获取结果集第一条记录<br>21 //    //$row_voteAnswers = $que_voteAnswer->execute();//和下面的fetchArray()方法基本等同,都需要沥遍<br>22 //    //$row_voteAnswers = $que_voteAnswer->fetchArray();<br>23 //    //foreach($row_voteAnswers as $row_voteAnswer){<br>24 //      $this->a = $row_voteAnswer['id'];<br>25 //    /
    
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Update one column of data in the table
From 1970-01-01 08:00:00
0
0
0
Optimize table indexes in MySQL
From 1970-01-01 08:00:00
0
0
0
Why can't the list be rendered?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template