rendered paste bodyfunction db_select($table,$fields,$condition){
if($condition!="") $r=mysql_query("SELECT ".$fields." FROM ".$table." WHERE ".$condition."");
else $r=mysql_query("SELECT ".$fields." FROM ".$table."");
if(!$r) return Array();
$n=mysql_num_rows($r);
for($i=0;$i<$n;$i++){
$a[$i]=mysql_fetch_array($r);
}
if(!is_array($a))
$a=Array();
return $a;
}
function db_update($table,$names,$values,$condition){
$an=explode(",",$names);
$t="";
$cnt=count($an)-1;
for($i=0;$i<$cnt;$i++){
$t.=$an[$i]."='".$values[$i]."'";
$t.=',';
}
$t.=$an[$i]."='".$values[$i]."'";
if($condition!="") mysql_query("UPDATE ".$table." SET ".$t." WHERE ".$condition."");
else mysql_query("UPDATE ".$table." SET ".$t."");
}
$tv=db_select("f_topics","topic_views","forum_id='".$forum_id."' AND topic_id='".$topic_id."' LIMIT 1");
$ntv=$tv[0]['topic_views']+1;
db_update("f_topics","topic_views",Array($ntv),"forum_id='".$forum_id."' AND topic_id='".$topic_id."'");