Home > php教程 > php手册 > php桌面中心(四) 数据显示

php桌面中心(四) 数据显示

WBOY
Release: 2016-06-13 12:33:04
Original
1034 people have browsed it

最后一步就是显示了。 
下面这个程序要通过参数来调用。 
比如php.php?jpg=jpg 
后面的jpg是表格名。记住一定要的呀,不然就不能运行了,会显示程序出错。 
大家可以把下面这个程序改一下。这样就可以更加美观了。 
以下是源程序: 
 

显示 
 
 
 
mysql_connect("localhost","用户名","密码") or die("无法联接数据库!"); 
$query="SELECT id,url,mess,fromx,url1,mess1,fromx1,url2,mess2,fromx2,url3,mess3,fromx3 from $jpg " ; 
$result=mysql_db_query("elong",$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("首页",$PHP_SELF,1); 
printf(" 前页",$PHP_SELF,$page-1); 
}else{ 
?> 首页 前页  

?> 
  
printf(" 后页",$PHP_SELF,$page+1); 
printf(" 尾页",$PHP_SELF,$pagecount); 
}else{?> 后页 尾页 }?>页次:/页 
 
 
if ($num0){ 
$pp=0; 
for($ipage=0;$ipage$i=($page-1)*$pagesize+$ipage; 
if($i $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; 
       ?> 
 
 
 
 
 
 
 
 " target="_blank">php桌面中心(四) 数据显示" width="160"  style="max-width:90%" border="4"> " target="_blank">php桌面中心(四) 数据显示" width="160"  style="max-width:90%" border="4">" target="_blank">php桌面中心(四) 数据显示" width="160"  style="max-width:90%" border="4">" target="_blank">php桌面中心(四) 数据显示" width="160"  style="max-width:90%" border="4">
 
 



?> 
   分页 
      printf("首页",$PHP_SELF,1); 
printf(" 前页",$PHP_SELF,$page-1); 
}else{ 
?> 首页 前页 }?> 
 printf(" 后页",$PHP_SELF,$page+1); 
printf(" 尾页",$PHP_SELF,$pagecount); 
}else{?> 后页 尾页 }?>页次:/页 
 
  
 
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template