<?php
$table_name='TAG';
$row = array (
'TAGNAME' => $tagname,
'TAGTOTAL' => '1'
);
$this->db->insert($table_name,$row);
?>
<?php
$where = $this->db->quoteInto('tagname = ?',$tagname);
//如果只取一行的话,用fetchRow()就可以了
$rowset = $this->tag->fetchAll($where);
$count=$rowset->count();
$tag = $rowset->current();
if($count!=0){
$tagid=$tag->TAGID;
//tagtotal+1
$tag->TAGTOTAL ++; //应判断一下当前用户是否
$tag->save();
}
?>
<?php
//删除已有的collect表中记录
// where条件语句
$where = $this->db->quoteInto('USERID = ?', $userid)
.$this->db->quoteInto('AND LINKID = ?', $linkid);
// 删除数据并得到影响的行数
$rows_affected = $this->collect->delete($where);
?>