问题画廊&分页PHP [英] Problem gallery & pagination PHP
本文介绍了问题画廊&分页PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Php / mysql gallery问题
我在php中创建了一个库。它从索引页面接收inname参数。每次从页面传递时,图库都无法同时发送2个参数,并且无法在所有内容中发送。数据库中无参数idtext
请告诉我错误
index.php >
Lista de Acontecimientos< Br /> <?php
$ conexion = mysqli_connect(localhost,root,)或trigger_error(mysql_error(),E_USER_ERROR);
mysqli_select_db($ conexion,db674013292);
$ consulta =从textos中选择*,其中clase = 1;
$ result = mysqli_query($ conexion,$ consulta);
?>
<?php
while($ fila = mysqli_fetch_row($ result)){
echo< a href = \H.php?inombre ='。$ fila [ '0']。\ > 中。$ FILA ['1' ]。 < / A><峰; br> 中;
}
?>
Gallery.php
<?php
$ inombre = $ _ GET ['inombre'];
$ objConnect = mysql_connect(localhost,root,)或die(mysql_error());
$ objDB = mysql_select_db(db674013292);
$ strSQL =SELECT * FROM galeriadecidiendo其中idtexto = $ inombre;
$ objQuery = mysql_query($ strSQL);
$ Num_Rows = mysql_num_rows($ objQuery);
$ Per_Page = 8; //每页
@ $ Page = $ _GET [Page];
if(!@ $ _ GET [Page])
{
$ Page = 1;
}
$ Prev_Page = $ Page-1;
$ Next_Page = $ Page + 1;
$ Page_Start =(($ Per_Page * $ Page) - $ Per_Page);
if($ Num_Rows< = $ Per_Page)
{
$ Num_Pages = 1;
}
else if(($ Num_Rows%$ Per_Page)== 0)
{
$ Num_Pages =($ Num_Rows / $ Per_Page);
}
其他
{
$ Num_Pages =($ Num_Rows / $ Per_Page)+1;
$ Num_Pages =(int)$ Num_Pages;
}
$ strSQL。=按idgaleriatexto排序ASC LIMIT $ Page_Start,$ Per_Page;
$ objQuery = mysql_query($ strSQL);
echo< table border = \0\align = \center \cellspacing = \0 \cellpadding = \0 \ >< TR> 中;
$ intRows = 0;
while($ objResult = mysql_fetch_array($ objQuery))
{
echo< td>;
$ intRows ++;
?>
< img with =150height =150src =<?= $ objResult [url];?>>< br>
<?PHP
echo< / td>;
if(($ intRows)%4 == 0)
{
echo< / tr>;
}
}
echo< / tr>< / table>;
?>
< br>
< span class =paguinas>总计<?= $ Num_Rows;?>记录:<?= $ Num_Pages;?>页面:< / span>
<?PHP
$ consulta =从textos中选择*,其中idtexto = $ inombre;
$ result = mysqli_query($ conexion,$ consulta);
if($ Prev_Page)
{
while($ fila = mysqli_fetch_row($ result)){
echo
< a href ='$ _ SERVER [SCRIPT_NAME] ]?Page = $ Prev_Page&?$ inombre = $ objResult [idtexto];'>
<< Back< / a>;
}
for($ i = 1; $ i< = $ Num_Pages; $ i ++){
if($ i!= $ Page)
{
while($ fila = mysqli_fetch_row($ result)){
echo< a href ='$ _ SERVER [SCRIPT_NAME]?Page =?$ i& inombre ='。$ fila ['0']。'\>。$ fila ['1']。< / a>< br>;
}}
else
{
echo $ i ;
}
}
if($ Page!= $ Num_Pages)
{
echo< a href ='$ _ SERVER [SCRIPT_NAME]?Page = $ Next_Page& inombre = idtexto'> Next>>< / a> ;
}
?>
<?PHP
mysql_close($ objConnect);
?>< br / >
我尝试过:
我试图将一个页面链接到另一个页面
解决方案
conexion = mysqli_connect(localhost,root,)或trigger_error(mysql_error(), E_USER_ERROR);
mysqli_select_db(
conexion,db674013292);
consulta =从textos中选择*,其中clase = 1 ;
Php / mysql gallery issues
I have made a gallery in php. It receives from an index page an "inname" parameter. The gallery every time it passes from page does not manage to send 2 parameters at the same time and in all inombre. Unparameter of the database "idtext"
Please tell me the mistakes
index.php
Lista de Acontecimientos<Br /> <?php $conexion = mysqli_connect("localhost", "root", "") or trigger_error(mysql_error(),E_USER_ERROR); mysqli_select_db($conexion,"db674013292"); $consulta="Select * from textos where clase=1 "; $result=mysqli_query($conexion,$consulta); ?> <?php while($fila=mysqli_fetch_row($result)){ echo "<a href=\"H.php?inombre='".$fila['0']."'\">".$fila['1']."</a><br>"; } ?>
Gallery.php
<?php $inombre=$_GET['inombre']; $objConnect = mysql_connect("localhost","root","") or die(mysql_error()); $objDB = mysql_select_db("db674013292"); $strSQL = "SELECT * FROM galeriadecidiendo where idtexto =$inombre "; $objQuery = mysql_query($strSQL); $Num_Rows = mysql_num_rows($objQuery); $Per_Page = 8; // Per Page @$Page = $_GET["Page"]; if(!@$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) { $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0) { $Num_Pages =($Num_Rows/$Per_Page) ; } else { $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $strSQL .=" order by idgaleriatexto ASC LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); echo"<table border=\"0\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\"><tr>"; $intRows = 0; while($objResult = mysql_fetch_array($objQuery)) { echo "<td>"; $intRows++; ?> <img with="150" height="150" src="<?=$objResult["url"]; ?>"><br> <?PHP echo"</td>"; if(($intRows)%4==0) { echo"</tr>"; } } echo"</tr></table>"; ?> <br> <span class="paguinas">Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page :</span> <?PHP $consulta="Select * from textos where idtexto =$inombre "; $result=mysqli_query($conexion,$consulta); if($Prev_Page) { while($fila=mysqli_fetch_row($result)){ echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&?$inombre=$objResult[idtexto];'> << Back</a> "; } } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { while($fila=mysqli_fetch_row($result)){ echo "<a href='$_SERVER[SCRIPT_NAME]?Page=?$i&inombre='".$fila['0']."'\">".$fila['1']."</a><br>"; }} else { echo " $i "; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&inombre=idtexto'>Next>></a> "; } ?> <?PHP mysql_close($objConnect); ?> <br />
What I have tried:
I tried to link one page to another
解决方案
conexion = mysqli_connect("localhost", "root", "") or trigger_error(mysql_error(),E_USER_ERROR); mysqli_select_db(
conexion,"db674013292");
consulta="Select * from textos where clase=1 ";
这篇关于问题画廊&分页PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文