par
sylvaing26 » 20 avr. 2007, 23:39
ok c'est tout bon ca marche !
encore merci
je met mon code source si ca êut aider quelq'un
Code : Tout sélectionner
$sql = mysql_query("SELECT nom, dossier FROM fleurs");
$nbmsg=mysql_num_rows($sql);
if($nbmsg=="")
{
echo "<center><b>Il n'y a pas de photos pour le moment</b></center><br><br><br>";
}
function CouperMot($result,$cut)
{
$message=wordwrap($result,$cut, " ", 1);
return $result;
}
//// Initialisation affichage page par page ////
if(empty($page)) $page=1;
if(empty($total))
{
$sql=mysql_query("SELECT nom, dossier FROM fleurs");
$total=mysql_num_rows($sql);
}
////ici $nb = '8' siginifie 8 resultats par page ///
$nb = '8';
//// On determine debut du limit ////
$debut=($page-1)*$nb;
$sql=mysql_query("SELECT nom, dossier FROM fleurs ORDER BY id DESC LIMIT $debut,$nb");
while($result=mysql_fetch_array($sql))
{
$result['nom']=CouperMot($result['nom'],$cut);
$dossier="$result[dossier]";
echo "<a href='voir.php?img=fleurs";
echo $result['dossier'];
echo $result['nom'];
echo "'>";
echo "<img src='fleurs";
echo $result['dossier'];
echo "vignettes/" ;
echo $result['nom'];
echo "' align='absmiddle' border='0' vspace='5' hspace='5'>";
echo "</a>";
}
}
mysql_close();
//// Calcul du nombre de pages ////
echo "<p style='margin-top:5; margin-right:30; margin-bottom:0; margin-left:30; padding:1px; border-top-width:1px; border-bottom-width:1px; border-bottom-color:rgb(87,113,39); border-top-style:dotted; border-bottom-style:dotted; border-tp-color:rgb(87,113,39);' align='right'>";
echo "<span style='font-size:8pt;'><font face='Verdana'>";
echo "Page :\n ";
$nbpages = ceil($total / $nb);
echo "</font>";
for($i = 1;$i <= $nbpages;$i ++)
{
echo "<a href=\"rubrique.php?id=3&rub=fleurs&full=yes&page=$i&total=$total\"><span style='font-size:8pt;'><font face='Verdana'>$i</a> \n";
if($i < $nbpages) {echo " - ";
}
}
echo "</p>";
echo "</font>";
echo "</span>";
echo "<p style='margin-top:5; margin-right:30; margin-bottom:0; margin-left:30; padding:1px; border-top-width:1px; border-bottom-width:1px; border-bottom-color:rgb(87,113,39); border-top-style:dotted; border-bottom-style:dotted; border-tp-color:rgb(87,113,39);' align='right'>";
echo "<a href='rubrique.php?id=3&rub=fleurs'><span style='font-size:8pt;'><font face='Verdana'>";
echo "Retour";
echo "</font>";
echo "</span>";
echo "</a></p>";
?>
J'avoue etant un novice, que ce code fait peur à voir mais c'est tout con, il suffit de s'y mettre un peu et ce n'est que boulette sur boulette et en cherchant des sources à droite à gauche qu'on arrive à faire notre propre code !!!
J'avoue aussi que ya des trucs là dedans que je ne pige pas non plus ...

ok c'est tout bon ca marche !
encore merci
je met mon code source si ca êut aider quelq'un
[code]$sql = mysql_query("SELECT nom, dossier FROM fleurs");
$nbmsg=mysql_num_rows($sql);
if($nbmsg=="")
{
echo "<center><b>Il n'y a pas de photos pour le moment</b></center><br><br><br>";
}
function CouperMot($result,$cut)
{
$message=wordwrap($result,$cut, " ", 1);
return $result;
}
//// Initialisation affichage page par page ////
if(empty($page)) $page=1;
if(empty($total))
{
$sql=mysql_query("SELECT nom, dossier FROM fleurs");
$total=mysql_num_rows($sql);
}
////ici $nb = '8' siginifie 8 resultats par page ///
$nb = '8';
//// On determine debut du limit ////
$debut=($page-1)*$nb;
$sql=mysql_query("SELECT nom, dossier FROM fleurs ORDER BY id DESC LIMIT $debut,$nb");
while($result=mysql_fetch_array($sql))
{
$result['nom']=CouperMot($result['nom'],$cut);
$dossier="$result[dossier]";
echo "<a href='voir.php?img=fleurs";
echo $result['dossier'];
echo $result['nom'];
echo "'>";
echo "<img src='fleurs";
echo $result['dossier'];
echo "vignettes/" ;
echo $result['nom'];
echo "' align='absmiddle' border='0' vspace='5' hspace='5'>";
echo "</a>";
}
}
mysql_close();
//// Calcul du nombre de pages ////
echo "<p style='margin-top:5; margin-right:30; margin-bottom:0; margin-left:30; padding:1px; border-top-width:1px; border-bottom-width:1px; border-bottom-color:rgb(87,113,39); border-top-style:dotted; border-bottom-style:dotted; border-tp-color:rgb(87,113,39);' align='right'>";
echo "<span style='font-size:8pt;'><font face='Verdana'>";
echo "Page :\n ";
$nbpages = ceil($total / $nb);
echo "</font>";
for($i = 1;$i <= $nbpages;$i ++)
{
echo "<a href=\"rubrique.php?id=3&rub=fleurs&full=yes&page=$i&total=$total\"><span style='font-size:8pt;'><font face='Verdana'>$i</a> \n";
if($i < $nbpages) {echo " - ";
}
}
echo "</p>";
echo "</font>";
echo "</span>";
echo "<p style='margin-top:5; margin-right:30; margin-bottom:0; margin-left:30; padding:1px; border-top-width:1px; border-bottom-width:1px; border-bottom-color:rgb(87,113,39); border-top-style:dotted; border-bottom-style:dotted; border-tp-color:rgb(87,113,39);' align='right'>";
echo "<a href='rubrique.php?id=3&rub=fleurs'><span style='font-size:8pt;'><font face='Verdana'>";
echo "Retour";
echo "</font>";
echo "</span>";
echo "</a></p>";
?>[/code]
J'avoue etant un novice, que ce code fait peur à voir mais c'est tout con, il suffit de s'y mettre un peu et ce n'est que boulette sur boulette et en cherchant des sources à droite à gauche qu'on arrive à faire notre propre code !!! :lol:
J'avoue aussi que ya des trucs là dedans que je ne pige pas non plus ... :roll: