【php开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了php开源代码-feedback.class.php的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
<?php
class feedback extends comment{
function feedback(){
parent::comment();
}
function add($record){
return $this->insert($record, 'feedback');
}
function edit($record){
$condition = "id = '{$record['id']}'";
unset($record['id']);
return $this->update($record, 'feedback', $condition);
}
function del($id){
$this->check_null($id, '用户ID');
$sql = "delete from feedback where id = {$id}";
return $this->DB->execute($sql);
}
function list_feedback($st = 0) {
$page_num = 30;
$pages = $this->build_pagelinks(array( 'TOTAL_POSS' => $this->get_count(),
'PER_PAGE' => $page_num,
'CUR_ST' => $st,
'BASE_URL' => "feedback.php?act=list_feedback"
)
);
$this -> assign( "pages" , $pages);
$sql = 'select * from feedback order by is_read desc,id desc LIMIT '.$st*$page_num.','.$page_num;
$rs = $this->DB->execute($sql);
$i=0;
while(!$rs->EOF()){
$row = $rs->fields;
$arr[] = $row;
$i++;
$rs->MoveNext();
}
return $arr;
}
function get_count(){
$sql = "SELECT COUNT(*) AS num FROM feedback";
$rs = $this->DB->Execute($
sql);
$row = $rs->fields;
return $row['num'];
}
function get_info($id){
$this->check_null($id, 'ID');
$sql = "update feedback set is_read = 1 where id = {$id}";
$this->DB->execute($sql);
$sql = "select * from feedback where id = {$id}";
$rs = $this->DB->execute($sql);
$row = $rs->fields;
return $row;
}
}
?>