Source: Aosuo.com
Desktop Center (4) Data Display
Author: elong
The last step is to display.
The following program needs to be called through parameters.
For example, php.php?jpg=jpg
The jpg after
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","username","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("
back page",$PHP_SELF,$page+1);
printf("
Last page",$PHP_SELF,$pagecount);
}else{?> Last page 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");
$mess2=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">
}
}
}
?>
Paging printf("Homepage",$PHP_SELF,1); printf(" Previous page< ;/a>",$PHP_SELF,$page-1); }else{ ?> Home page previous page}?> printf(" Next page",$PHP_SELF,$page+1); printf(" Last page a>",$PHP_SELF,$pagecount); }else{?> Last page}?>Page: strong>/page
|