SoFunction
Updated on 2025-04-04

php desktop center (IV) data display

The last step is to show it.
The following program needs to be called through parameters.
For example?jpg=jpg
The jpg behind is the table name. Remember to be sure, otherwise it will not be able to run, and the program will appear to have an error.
You can change the following program. This will make it more beautiful.
The following is the source program:
<html> 
<head><title>Show</title>
</head> 
<body> 
<? 
mysql_connect("localhost","username","password") or die("Cannot 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); 
?> 
<?if ($page!=1 and $num!=0){ 
printf("<a href="%s?page=%s&jpg=$jpg">Home</a>",$PHP_SELF,1);
printf("<a href="%s?page=%s&jpg=$jpg"> Previous page</a>",$PHP_SELF,$page-1);
}else{ 
?> Home page Previous page <?

?> 
</font>&nbsp; 
<?if ($page!=$pagecount and $num!=0){ 
printf("<a href="%s?page=%s&jpg=$jpg"> Last page</a>",$PHP_SELF,$page+1);
printf("<a href="%s?page=%s&jpg=$jpg"> Last Page</a>",$PHP_SELF,$pagecount);
}else{?> Last page Last page <?}?>Page: <strong><?echo $page?></strong><?echo $pagecount?></strong>Page
</span></td> 
<? 
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; 
 ?> 
<table width="668" border="2" cellspacing="0" cellpadding="0" align="center" bordercolor="#FFFFFF"> 
<tr> 
<td width="167" height="127"> <a href="<?echo $url?>" target="_blank"><IMG border=0 src="<?echo $mess?>" width="160" height="120" border="4"></td> 
<td width="167" height="127"><a href="<?echo $url1?>" target="_blank"><IMG border=0 src="<?echo $mess1?>" width="160" height="120" border="4"></td> 
<td width="167" height="127"><a href="<?echo $url2?>" target="_blank"><IMG border=0 src="<?echo $mess2?>" width="160" height="120" border="4"></td> 
<td width="167" height="127"><a href="<?echo $url3?>" target="_blank"><IMG border=0 src="<?echo $mess3?>" width="160" height="120" border="4"></td> 
</tr> 
</table> 
<? 



?> 
<td«nowrap align=center> <span class=smallFont><span class=titleFont>Pagination</span>
 <font color=darkgray> <?if ($page!=1 and $num!=0){ 
printf("<a href="%s?page=%s&jpg=$jpg">Home</a>",$PHP_SELF,1);
printf("<a href="%s?page=%s&jpg=$jpg"> Previous page</a>",$PHP_SELF,$page-1);
}else{ 
?> Homepage Previous page <?}?> </font>&nbsp;<?if ($page!=$pagecount and $num!=0){
printf("<a href="%s?page=%s&jpg=$jpg"> Last page</a>",$PHP_SELF,$page+1);
printf("<a href="%s?page=%s&jpg=$jpg"> Last Page</a>",$PHP_SELF,$pagecount);
}else{?> Last page Last page <?}?>Page: <strong><?echo $page?></strong><?echo $pagecount?></strong>Page
</span></td> 
 </TABLE></DIV></CENTER> 
</BODY></HTML>