par
djtec » 14 juin 2007, 15:54
Bonjour,
Voila j'ai un script pour afficher des images un peu comme une gallerie mais le problème c'est qu'il bug au niveau des lignes.
Il devrait y avoir 2 images par ligne et la il me crée:
1 ligne de 1 images
1 ligne de 2 images
1 ligne de 1 images
Et en tout j'ai 4 images d'enregistrées dans ma base
Voici un screen
Je vous joint mon script
<table align="center" width="100">
<?
$nbpg = $board_rangpg;
$nblig = $board_ranglig;
if (!isset($_GET['page'])) $page = 1;
else $page = intval($_GET['page']);
if (!isset($_GET['total']))
{
$sql = "select count(*) as qte from ".$prefixe."_rang";
$p = @mysql_query($sql,$c);
$total = @mysql_result($p,'0','qte');
}
else $total = intval($_GET['total']);
$debut = ($page - 1) * $nbpg;
$sql = "SELECT * FROM ".$prefixe."_rang ORDER BY id DESC LIMIT ".intval($debut).",".intval($nbpg)."";
if($p = @mysql_query($sql,$c)){
$i = 1;
while($resultat = @mysql_fetch_array($p)){
if (!($i++%$nblig)) echo "</tr>\n";
echo "\n";
?>
<td>
<div align="center">
<table class="kit" width="400" height="100">
<tr>
<td valign="top" width="190" align="center"><img border="0" src="<? echo ''.stripslashes($resultat['img1']).''; ?>" /><br /><br /><img border="0" src="<? echo ''.stripslashes($resultat['img2']).''; ?>" /></td>
<td valign="top" width="10"> </td>
<td valign="top" width="390" align="left">
<b>Nom du kit:</b> <? echo ''.stripslashes($resultat['nom']).''; ?><br />
<b>Language:</b> <? echo ''.stripslashes($resultat['language']).''; ?><br />
<b>Télécharger:</b> <? echo ''.stripslashes($resultat['hit']).''; ?>
</td>
<td valign="top" width="10"> </td>
</tr>
</table>
</div>
</td>
<?php
if (!($i%$nblig)) echo "</tr>\n";
}
if ($i%$nblig) echo "</tr>\n";
echo'';
if($total < 1) echo'
<div align="center">
<table cellpadding="0" cellspacing="0" align="center" width="685">
<tr>
<td align="center">Aucune images de rangs pour le moment.</td>
</tr>
</table>
</div>
';
?>
</table>
<br />
<div align="right">
<?
$nbpages = ceil($total / $nbpg);
echo'<div align="right">';
$page_moins_un = $page-1;
if($page_moins_un >= 1)
{
echo'<a href="?name=rang&page='.$page_moins_un.'&total='.$total.'" class="page">«</a> ';
}
for($i = 1;$i <= $nbpages;$i ++)
{
echo'<a href="?name=rang&page='.$i.'&total='.$total.'" class="page">'.$i.'</a> ';
if($i < $nbpages) echo '';
}
$page_plus_un = $page+1;
if($page_plus_un <= $nbpages)
{
echo'<a href="?name=rang&page='.$page_plus_un.'&total='.$total.'" class="page">»</a>';
}
echo'</div>';
}
mysql_close();
?>
</div>
Sa fait 2 jours que je me prend la tête mais je trouve pas d'ou viens le problème
Merci d'avance
Bonjour,
Voila j'ai un script pour afficher des images un peu comme une gallerie mais le problème c'est qu'il bug au niveau des lignes.
Il devrait y avoir 2 images par ligne et la il me crée:
1 ligne de 1 images
1 ligne de 2 images
1 ligne de 1 images
Et en tout j'ai 4 images d'enregistrées dans ma base
Voici un screen
[img]http://www.studio-graf.com/images/demo.png[/img]
Je vous joint mon script
[php]<table align="center" width="100">
<?
$nbpg = $board_rangpg;
$nblig = $board_ranglig;
if (!isset($_GET['page'])) $page = 1;
else $page = intval($_GET['page']);
if (!isset($_GET['total']))
{
$sql = "select count(*) as qte from ".$prefixe."_rang";
$p = @mysql_query($sql,$c);
$total = @mysql_result($p,'0','qte');
}
else $total = intval($_GET['total']);
$debut = ($page - 1) * $nbpg;
$sql = "SELECT * FROM ".$prefixe."_rang ORDER BY id DESC LIMIT ".intval($debut).",".intval($nbpg)."";
if($p = @mysql_query($sql,$c)){
$i = 1;
while($resultat = @mysql_fetch_array($p)){
if (!($i++%$nblig)) echo "</tr>\n";
echo "\n";
?>
<td>
<div align="center">
<table class="kit" width="400" height="100">
<tr>
<td valign="top" width="190" align="center"><img border="0" src="<? echo ''.stripslashes($resultat['img1']).''; ?>" /><br /><br /><img border="0" src="<? echo ''.stripslashes($resultat['img2']).''; ?>" /></td>
<td valign="top" width="10"> </td>
<td valign="top" width="390" align="left">
<b>Nom du kit:</b> <? echo ''.stripslashes($resultat['nom']).''; ?><br />
<b>Language:</b> <? echo ''.stripslashes($resultat['language']).''; ?><br />
<b>Télécharger:</b> <? echo ''.stripslashes($resultat['hit']).''; ?>
</td>
<td valign="top" width="10"> </td>
</tr>
</table>
</div>
</td>
<?php
if (!($i%$nblig)) echo "</tr>\n";
}
if ($i%$nblig) echo "</tr>\n";
echo'';
if($total < 1) echo'
<div align="center">
<table cellpadding="0" cellspacing="0" align="center" width="685">
<tr>
<td align="center">Aucune images de rangs pour le moment.</td>
</tr>
</table>
</div>
';
?>
</table>
<br />
<div align="right">
<?
$nbpages = ceil($total / $nbpg);
echo'<div align="right">';
$page_moins_un = $page-1;
if($page_moins_un >= 1)
{
echo'<a href="?name=rang&page='.$page_moins_un.'&total='.$total.'" class="page">«</a> ';
}
for($i = 1;$i <= $nbpages;$i ++)
{
echo'<a href="?name=rang&page='.$i.'&total='.$total.'" class="page">'.$i.'</a> ';
if($i < $nbpages) echo '';
}
$page_plus_un = $page+1;
if($page_plus_un <= $nbpages)
{
echo'<a href="?name=rang&page='.$page_plus_un.'&total='.$total.'" class="page">»</a>';
}
echo'</div>';
}
mysql_close();
?>
</div>[/php]
Sa fait 2 jours que je me prend la tête mais je trouve pas d'ou viens le problème
Merci d'avance