par
sylvaing26 » 22 avr. 2007, 00:21
Encore moi,
lorsque j'interroge ma BDD pour
tout fonction, ensuite si
il m'affiche bien les images mais pas le nombre de pages
voici mon code complet :
Code : Tout sélectionner
<?php
$id == $_GET['id'];
$srb == $_GET['srb'];
include ("inc/connect.php");
if ($id == 1 && $srb ==1){
@MYSQL_CONNECT($serveur,$utilisateur,$mdp) or die ("Connexion impossible");
@MYSQL_SELECT_DB($db) or die ("Connexion à la base $base impossible");
function CouperMot($result,$cut)
{
$message=wordwrap($result,$cut, " ", 1);
return $result;
}
if ($id == 1 && $srb == 1){
$sql = mysql_query("SELECT nom, dossier, titre FROM animaux WHERE dossier='/domestiques/'
");
$nbmsg=mysql_num_rows($sql);
if($nbmsg=="")
{
echo "<center><b><p style margin-top:20;>Il n'y a pas de photos pour le moment</b></center></p>";
}
}
//// Initialisation affichage page par page ////
if(empty($page)) $page=1;
if(empty($total))
{
$sql=mysql_query("SELECT nom, dossier, titre FROM animaux WHERE dossier='/domestiques/'");
$total=mysql_num_rows($sql);
}
$nb = '8';
//// On determine debut du limit ////
$debut=($page-1)*$nb;
$sql=mysql_query("SELECT nom, dossier, titre FROM animaux WHERE dossier='/domestiques/' ORDER BY id DESC LIMIT $debut,$nb");
while($result=mysql_fetch_array($sql))
{
$result['nom']=CouperMot($result['nom'],$cut);
$result['dossier']=CouperMot($result['dossier'],$cut);
$titre="$result[titre]";
///////////////////////////
echo "<a href='voir.php?img=animaux";
////////////////////////////////////////
echo $result['dossier'];
echo $result['nom'];
echo "'>";
echo "<img src='animaux";
echo $result['dossier'];
echo "vignettes/" ;
echo $result['nom'];
echo "' align='absmiddle' border='0' vspace='5' hspace='5' alt='$result[titre]'>";
echo "</a>";
}
mysql_close();
//// Calcul du nombre de pages ////
if($nbmsg > 0)
{
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=1&rub=animaux&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=1&rub=animaux'><span style='font-size:8pt;'><font face='Verdana'>";
////////////////////////////
echo "Retour";
echo "</font>";
echo "</span>";
echo "</a></p>";
}
//////////////////////////////// //// /////////////////////////
elseif ($id == 1 && $srb == 2){
@MYSQL_CONNECT($serveur,$utilisateur,$mdp) or die ("Connexion impossible");
@MYSQL_SELECT_DB($db) or die ("Connexion à la base $base impossible");
function CouperMot($result,$cut)
{
$message=wordwrap($result,$cut, " ", 1);
return $result;
}
if ($id == 1 && $srb == 1){
$sql = mysql_query("SELECT nom, dossier, titre FROM animaux WHERE dossier='/ferme/'");
$nbmsg=mysql_num_rows($sql);
if($nbmsg=="")
{
echo "<center><b><p style margin-top:20;>Il n'y a pas de photos pour le moment</b></center></p>";
}
}
//// Initialisation affichage page par page ////
if(empty($page)) $page=1;
if(empty($total))
{
$sql=mysql_query("SELECT nom, dossier, titre FROM animaux WHERE dossier='/ferme/'");
$total=mysql_num_rows($sql);
}
$nb = '8';
//// On determine debut du limit ////
$debut=($page-1)*$nb;
$sql=mysql_query("SELECT nom, dossier, titre FROM animaux WHERE dossier='/ferme/' ORDER BY id DESC LIMIT $debut,$nb");
while($result=mysql_fetch_array($sql))
{
$result['nom']=CouperMot($result['nom'],$cut);
$result['dossier']=CouperMot($result['dossier'],$cut);
$titre="$result[titre]";
///////////////////////////
echo "<a href='voir.php?img=animaux";
////////////////////////////////////////
echo $result['dossier'];
echo $result['nom'];
echo "'>";
echo "<img src='animaux";
echo $result['dossier'];
echo "vignettes/" ;
echo $result['nom'];
echo "' align='absmiddle' border='0' vspace='5' hspace='5' alt='$result[titre]'>";
echo "</a>";
}
mysql_close();
//// Calcul du nombre de pages ////
if($nbmsg > 0)
{
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=1&rub=animaux&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=1&rub=animaux'><span style='font-size:8pt;'><font face='Verdana'>";
////////////////////////////
echo "Retour";
echo "</font>";
echo "</span>";
echo "</a></p>";
}
?>
<p> </p>
Encore moi,
lorsque j'interroge ma BDD pour [code]if ($id == 1 && $srb ==1)[/code]
tout fonction, ensuite si
[code]if ($id == 1 && $srb ==2)[/code] il m'affiche bien les images mais pas le nombre de pages
voici mon code complet :
[code]<?php
$id == $_GET['id'];
$srb == $_GET['srb'];
include ("inc/connect.php");
if ($id == 1 && $srb ==1){
@MYSQL_CONNECT($serveur,$utilisateur,$mdp) or die ("Connexion impossible");
@MYSQL_SELECT_DB($db) or die ("Connexion à la base $base impossible");
function CouperMot($result,$cut)
{
$message=wordwrap($result,$cut, " ", 1);
return $result;
}
if ($id == 1 && $srb == 1){
$sql = mysql_query("SELECT nom, dossier, titre FROM animaux WHERE dossier='/domestiques/'
");
$nbmsg=mysql_num_rows($sql);
if($nbmsg=="")
{
echo "<center><b><p style margin-top:20;>Il n'y a pas de photos pour le moment</b></center></p>";
}
}
//// Initialisation affichage page par page ////
if(empty($page)) $page=1;
if(empty($total))
{
$sql=mysql_query("SELECT nom, dossier, titre FROM animaux WHERE dossier='/domestiques/'");
$total=mysql_num_rows($sql);
}
$nb = '8';
//// On determine debut du limit ////
$debut=($page-1)*$nb;
$sql=mysql_query("SELECT nom, dossier, titre FROM animaux WHERE dossier='/domestiques/' ORDER BY id DESC LIMIT $debut,$nb");
while($result=mysql_fetch_array($sql))
{
$result['nom']=CouperMot($result['nom'],$cut);
$result['dossier']=CouperMot($result['dossier'],$cut);
$titre="$result[titre]";
///////////////////////////
echo "<a href='voir.php?img=animaux";
////////////////////////////////////////
echo $result['dossier'];
echo $result['nom'];
echo "'>";
echo "<img src='animaux";
echo $result['dossier'];
echo "vignettes/" ;
echo $result['nom'];
echo "' align='absmiddle' border='0' vspace='5' hspace='5' alt='$result[titre]'>";
echo "</a>";
}
mysql_close();
//// Calcul du nombre de pages ////
if($nbmsg > 0)
{
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=1&rub=animaux&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=1&rub=animaux'><span style='font-size:8pt;'><font face='Verdana'>";
////////////////////////////
echo "Retour";
echo "</font>";
echo "</span>";
echo "</a></p>";
}
//////////////////////////////// //// /////////////////////////
elseif ($id == 1 && $srb == 2){
@MYSQL_CONNECT($serveur,$utilisateur,$mdp) or die ("Connexion impossible");
@MYSQL_SELECT_DB($db) or die ("Connexion à la base $base impossible");
function CouperMot($result,$cut)
{
$message=wordwrap($result,$cut, " ", 1);
return $result;
}
if ($id == 1 && $srb == 1){
$sql = mysql_query("SELECT nom, dossier, titre FROM animaux WHERE dossier='/ferme/'");
$nbmsg=mysql_num_rows($sql);
if($nbmsg=="")
{
echo "<center><b><p style margin-top:20;>Il n'y a pas de photos pour le moment</b></center></p>";
}
}
//// Initialisation affichage page par page ////
if(empty($page)) $page=1;
if(empty($total))
{
$sql=mysql_query("SELECT nom, dossier, titre FROM animaux WHERE dossier='/ferme/'");
$total=mysql_num_rows($sql);
}
$nb = '8';
//// On determine debut du limit ////
$debut=($page-1)*$nb;
$sql=mysql_query("SELECT nom, dossier, titre FROM animaux WHERE dossier='/ferme/' ORDER BY id DESC LIMIT $debut,$nb");
while($result=mysql_fetch_array($sql))
{
$result['nom']=CouperMot($result['nom'],$cut);
$result['dossier']=CouperMot($result['dossier'],$cut);
$titre="$result[titre]";
///////////////////////////
echo "<a href='voir.php?img=animaux";
////////////////////////////////////////
echo $result['dossier'];
echo $result['nom'];
echo "'>";
echo "<img src='animaux";
echo $result['dossier'];
echo "vignettes/" ;
echo $result['nom'];
echo "' align='absmiddle' border='0' vspace='5' hspace='5' alt='$result[titre]'>";
echo "</a>";
}
mysql_close();
//// Calcul du nombre de pages ////
if($nbmsg > 0)
{
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=1&rub=animaux&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=1&rub=animaux'><span style='font-size:8pt;'><font face='Verdana'>";
////////////////////////////
echo "Retour";
echo "</font>";
echo "</span>";
echo "</a></p>";
}
?>
<p> </p>
[/code]