查询,
关键字
fetch_one_array("SELECT COUNT(*) AS count FROM " . $db_prefix . "article AS article WHERE sortid IN (0" . $subsortids . ") AND visible=1"); $totalresults = $total[count]; $totalpages = ceil($total[count] / $perpage); if ($pagenum < 1 OR empty($pagenum)) { $pagenum = 1; } elseif ($pagenum > $totalpages) { $pagenum = $totalpages; } $offset = ($pagenum-1) * $perpage; if ($totalresults > 0) { $from = $offset + 1; if ($pagenum == $totalpages) { $to = $totalresults; } else { $to = $offset + $perpage; } } else { $from = 0; $to = 0; } $articles = $DB->query("SELECT article.* FROM " . $db_prefix . "article AS article WHERE sortid IN (0" . $subsortids . ") AND visible=1 ORDER BY date LIMIT $offset,$perpage"); if ($DB->num_rows($articles) > 0) { $counter = 0; $row = 0; $division = $sortinfo[division_article]; $tablewidth = floor(100 / $division); echo "
"; $i=1; while ( $article = $DB->fetch_array($articles)) { $article[time] = padate($timeformat_article, $article[date]); $article[date] = padate($dateformat_article, $article[date]); if (!empty($article[imageid])) { $article[img] = "\"$article[title]\""; } else { $article[img] = ""; } if ($i==1){ echo ""; } echo ""; $i++; if ($i>=3) { echo ""; $i=1; } } echo "
"; echo ""; $articletexts=$DB->query("select * from " . $db_prefix . "articletext"); $articletext = $DB->fetch_one_array("SELECT * FROM " .$db_prefix. "articletext WHERE articleid=$article[articleid]"); $articletext[articletext]=wordscut($articletext[articletext],96); echo "
".$article[img]."
".$article[title]."
".$articletext[articletext]."
"; $article[description] = str_replace(" ", "  ", nl2br($article[description])); } $pagelinks = makepagelink2("$phparticleurl/view.php?sortid=$sortid",$pagenum,$totalpages); ?>
,显示 -