The last step is to display.
The following program needs to be called through parameters.
For example, php.php?jpg=jpg
The jpg behind is the table name. Remember it is necessary, otherwise it will not run and a program error will be displayed.
You can change the program below. This will make it more beautiful.
The following is the source program:
Display mysql_connect("localhost","User name","password") or die("Unable to connect to the database!");
$query="SELECT id,url,mess,fromx,url1,mess1,fromx1,url2,mess2,fromx2,url3,mess3,fromx3 from $jpg " ;
$result=mysql_db_query("elong",$query); //Execute query
$num=mysql_numrows($result);
$page=round($page);
$pagesize=4;
if ($page==0){
$page=1;}
else{
$page=$page;}
$pagecount=($num)/$pagesize;
$pagecount=ceil($pagecount);
? >
printf("
Homepage ",$PHP_SELF,1);
printf("
previous page",$PHP_SELF,$page-1);
}else{
?> Home page Previous page
}
?>
printf("< ;a href="%s?page=%s&jpg=$jpg"> Back page",$PHP_SELF,$page+1);
printf("
Last page",$PHP_SELF,$pagecount);
}else{?> Next page Last page }?>Page:
/
page
if ($num<>0){
$pp=0;
for($ipage=0;$ipage<$pagesize;$ipage++){
$i=($page-1)*$pagesize+$ipage;
if($i < $num) {
$id=mysql_result($result,$i,"id");
$url=mysql_result($result,$i,"url");
$mess=mysql_result ($result,$i,"mess");
$fromx=mysql_result($result,$i,"fromx");
$url1=mysql_result($result,$i,"url1");
$mess1= mysql_result($result,$i,"mess1");
$fromx1=mysql_result($result,$i,"fromx1");
$url2=mysql_result($result,$i,"url2"); =mysql_result($result,$i,"mess2");
$fromx2=mysql_result($result,$i,"fromx2");
$url3=mysql_result($result,$i,"url3");
$ mess3=mysql_result($result,$i,"mess3");
$fromx3=mysql_result($result,$i,"fromx3");
$pp=$pp+1;
?>
|
|
< td width="167" height="127">
|
}
}
}
?>
gt;< ;span class=titleFont>Paging printf("Homepage",$PHP_SELF,1); printf(" Previous page ",$PHP_SELF,$page-1); }else{ ?> Home Page Previous Page }?> printf(" Next page",$PHP_SELF,$page+1); printf(" Last page", $PHP_SELF,$pagecount); }else{?> Next page Last page }?>Page: /Page
|
The above introduces the PHP Desktop Center 4 data display, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.