Home > Backend Development > PHP Tutorial > Article Recommendation System (3)_PHP Tutorial

Article Recommendation System (3)_PHP Tutorial

WBOY
Release: 2016-07-21 16:06:25
Original
1192 people have browsed it

=====Article.php====
if(!isset($pagenum)){
   $pagenum=1;}
$conn=mysql_connect("localhost","user","password");
mysql_select_db("bamboo");
$sql="select count(*) from article";
$result=mysql_query($sql,$conn);
$count=mysql_result($result,0);
$sign=0;
$lesssign=0;
$pagec=1;
    for($icount=0;($icount<$count)&&($sign=0);$icount+=16){
      for($i=0;$i<=16;$i++){
        if(($icount*16+$i)==$count)
          $sign=1;
       }
    $pagec++;
    }
    $dispeof=16*$pagenum;
  $dispend=16*($pagenum-1);
  if($count>=(16*$pagenum))
    $dispbeg=16*$pagenum;
  else
    $dispbeg=$count;
     $isdispnum=$count-$dispeof;
    if($isdispnum<0){
      $lesssign=1;
    }
  echo"

";
   $fuhao="◇  ";
    $color=e9eae9;
    $iscolor=0;
    $lessnum=0;
  for($i=$dispbeg;$i>$dispend;$i--){
      $sql="select *from article where id='$i'";
      $result=mysql_query($sql,$conn);
       echo"";
      $lessnum++;
         if($iscolor==0){
         $color=ffffff;
         $iscolor=1;
       }
       else{
         $color=e9eae9;
         $iscolor=0;
       }
      }
       if($lesssign==1){
      for($iless=$lessnum;$iless<=16;$iless++){
       echo"";
          if($iscolor==0){
         $color=ffffff;
         $iscolor=1;
       }
       else{
         $color=e9eae9;
         $iscolor=0;
       }
       }
    }
echo "
";
       echo $fuhao;
      echo"";
      $obj=mysql_fetch_object($result);
      echo $obj->articlename;
      echo"
";
       echo $fuhao."
n";
       echo"
";
?>


> echo"";
$str="shared";
$str=$str.strval($pagec);
$str=$str. "page";
echo"";
echo"";
echo"";
echo"";
echo"
$str";
echo"
";
$str="The current page is "";
$str=$str.strval($pagenum);
$str=$str."Page";
echo $str;
echo"
";
echo"Go to page";
for($i=1;$i<=$pagec;$i++){
$strpage=" ";
$strpage=$strpage.strval($i);
$strpage=$strpage." ";
echo"$strpage";
}
echo"page";
echo"
";
mysql_close($conn);
?>

(To be continued) )



http://www.bkjia.com/PHPjc/315373.html

truehttp: //www.bkjia.com/PHPjc/315373.htmlTechArticle=====Article.php==== ? if(!isset($pagenum)){ $ pagenum=1;} $conn=mysql_connect(localhost,user,password); mysql_select_db(bamboo); $sql=select count(*) from article; $result=mysql_que...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template