Desktop Center (iv) data display _php base
Last Update:2017-01-18
Source: Internet
Author: User
Source: Osso Network
Desktop Center (iv) data display
Author: elong
The last step is to show.
The following program is called by parameter.
Like Php.php?jpg=jpg.
The following JPG is the table name. Remember that you must, or you can not run, will show a program error.
You can change the following procedure. This will be more beautiful.
The following are the source programs:
<body>
?
mysql_connect ("localhost", "username", "password") or Die ("Cannot join 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 "> front page </a>", $PHP _self, $page-1);
}else{
?> Home Front Page
}
?>
</font>
<?if ($page!= $pagecount and $num!=0) {
printf ("<a href="%s?page=%s&jpg= $jpg "> Back Page </a>", $PHP _self, $page + 1);
printf ("<a href="%s?page=%s&jpg= $jpg "> Last </a>", $PHP _self, $pagecount);
}else{?> Next Last Page > page: <strong><?echo $page? ></strong>/<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");
$url 1=mysql_result ($result, $i, "URL1");
$mess 1=mysql_result ($result, $i, "Mess1");
$fromx 1=mysql_result ($result, $i, "fromx1");
$url 2=mysql_result ($result, $i, "url2");
$mess 2=mysql_result ($result, $i, "Mess2");
$fromx 2=mysql_result ($result, $i, "fromx2");
$url 3=mysql_result ($result, $i, "url3");
$mess 3=mysql_result ($result, $i, "MESS3");
$fromx 3=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" > "width=" 160 "height=" border= "4" ></td>
<TD width= "167" height= "127" ><a href= "<?echo $url 1?>" target= "_blank" > "width=" 160 "height=" border= "4" ></td>
<TD width= "167" height= "127" ><a href= "<?echo $url 2?>" target= "_blank" > "width=" 160 "height=" border= "4" ></td>
<TD width= "167" height= "127" ><a href= "<?echo $url 3?>" target= "_blank" > "width=" 160 "height=" border= "4" ></td>
</tr>
</table>
?
}
}
}
?>
<TD nowrap align=center> <span class=smallfont><span class=titlefont> Paging </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 "> front page </a>", $PHP _self, $page-1);
}else{
?> Home Front Page > </font> <?if ($page!= $pagecount and $num!=0) {
printf ("<a href="%s?page=%s&jpg= $jpg "> Back Page </a>", $PHP _self, $page + 1);
printf ("<a href="%s?page=%s&jpg= $jpg "> Last </a>", $PHP _self, $pagecount);
}else{?> Next Last Page > page: <strong><?echo $page? ></strong>/<strong><?echo $pagecount?></strong> page
</span></td>
</TABLE></DIV></CENTER>
</BODY></HTML>