Connecture News

0) { $sql .=" ,tags, tags_lookup where tags.tagid = tags_lookup,tag_id and tags_lookup.articles_id = articles.id"; $and = true; } if($cat > 0) { if($and) $sql .=" and cat = '".$cat."'"; else $sql.=" where cat = '".$cat."'"; $and = true; } if($term != '') { $words = explode(' ',$term); if(count($words) > 1) { if($and) $ssql = " and "; else $ssql = ""; foreach($words as $word => $value) { $ssql .= " (title like '%".$value."%' OR intro like '%".$value."%' OR content like '%".$value."%') OR "; } $ssql = substr($ssql,0,strlen($ssql)-3); $sql .= $ssql; } else { if($and) $sql .= " amd (title like '%".$term."%' OR intro like '%".$term."%' OR content like '%".$term."%')";# else $sql .= " (title like '%".$term."%' OR intro like '%".$term."%' OR content like '%".$term."%')";# } $sql .= " group by id"; $and = true; } $sql .= " group by id"; $rows = $db->query($sql); $rowcount = $rows->num_rows; $and = true; $sql = 'select t.tagid, t.tagname, tl.tag_id, tl.tag_id, tl.articles_id, tl.id, b.title, b.image, b.datetime, b.intro, b.id as blogid, b.cat, catid, category from articles b, categories, tags t, tags_lookup tl where categories.catid = b.cat'; if($cat > 0) { $sql.=" and b.cat = '".$cat."'"; $and = true; } if($tag > 0) { if($and) { $sql .=" and t.tagid = ".$tag." and tl.tag_id = t.tagid and b.id = tl.articles_id"; $and = true; } else { $sql .=" t.tagid = ".$tag." and tl.tag_id = t.tagid and b.id = tl.articles_id"; $and = true; } } if($term != '') { $words = explode(' ',$term); if(count($words) > 1) { if($and) { $ssql = " and "; } else { $ssql = ""; } foreach($words as $word => $value) { $ssql .= " (title like '%".$value."%' OR intro like '%".$value."%' OR content like '%".$value."%') OR "; } $ssql = substr($ssql,0,strlen($ssql)-3); $sql .= $ssql; } else $sql .= " and (title like '%".$term."%' OR intro like '%".$term."%' OR content like '%".$term."%')"; $sql .= " group by b.id"; } $sql .= ' group by b.id order by datetime desc limit ' . ($page * $records_per_page) . ','.$records_per_page; $rows = $db->query($sql); // pass the total number of records to the pagination class $pagination->records($rowcount); // records per page $pagination->records_per_page($records_per_page); while($row = $rows->fetch_assoc()) { ?>

render(); ?>