par
dudu60 » 21 oct. 2005, 00:03
Voila un code qui marche sur mon site
<?php
include("connection.php");
require("config.inc.php");
if (isset($_GET["Pos"]))
{$Pos=$_GET["Pos"];}
else
{$Pos="";}
$query = "select * from tblphotos where Id=$Pos";
$result = mysql_query($query) or die ("Execution de la reqête impossible");
$Ref_img=mysql_result($result,0,"Ref_Image");
$Leg_img=mysql_result($result,0,"Legende_Image");
$Id_Theme=mysql_result($result,0,"Index_Theme");
//infos sur le thème en cours
$chaine="SELECT Legende_Theme FROM tblTheme WHERE Index_Theme=$Id_Theme";
$request = MYSQL_QUERY($chaine);
$nom_themeencours = mysql_result($request,0,"Legende_Theme");
echo "   <a href=Themes.php><big><big>Themes</big></big></a> <<<  <a href=Photos.php?theme=$Id_Theme><big><big>$nom_themeencours</big></big></a><BR><BR>";
//RECHERCHE IMAGE DEMANDEE
$chaine="select * from tblPhotos where Id=$Pos";
$request= mysql_query($chaine) or die ("Execution de la reqête impossible");
$theme=mysql_result($request,0,"Index_Theme");
//RECHERCHE IMAGE PRECEDENTE
$chaine="select Id from tblPhotos where Index_Theme= $theme AND Id < $Pos ORDER by ID DESC";
$list_avant = mysql_query($chaine) or die ("Execution de la reqête impossible AVANT ");
$nb_img_avant = mysql_num_rows($list_avant);
if($nb_img_avant>0) {$id_img_avant=mysql_result($list_avant,0,"Id");}
//IMAGE AFFICHEE
$num_img_current=$nb_img_avant+1;
//RECHERCHE IMAGE SUIVANTE
$chaine="select Id from tblPhotos where Index_Theme= $theme AND Id > $Pos ";
$list_apres = mysql_query($chaine) or die ("Execution de la reqête impossible APRES");
$nb_img_apres = mysql_num_rows($list_apres);
if($nb_img_apres>0) {$id_img_apres=mysql_result($list_apres,0,"Id");}
//RECHERCHE NOMBRE PHOTOS TOTALES DU THEME SELECTIONNE
$chaine="select * from tblPhotos where Index_Theme= $theme ORDER by Id DESC";
$list_img = mysql_query($chaine) or die ("Execution de la reqête impossible ENCOURS");
$nb_img = mysql_num_rows($list_img);
echo "<center>";
echo" <big><big>$Leg_img</big></big><BR><BR>";
//AFFICHAGE SIGNE IMAGE PRECEDENTE
if ($nb_img_avant>0)
{
echo "<a href=Photos_Vue.php?Pos=$id_img_avant><img border=0 src=prec.png></a>   ";
}
//AFFICHAGE SIGNE IMAGE SUIVANTE
if ($nb_img_apres>0)
{
echo "   <a href=Photos_Vue.php?Pos=$id_img_apres><img border=0 src=suiv.png></a>";
}
//AFFICHAGE PHOTO DEMANDEE
echo "<BR><br><Img border=3 src=Photos/$Ref_img ></center>";
Voila un code qui marche sur mon site
[php]<?php
include("connection.php");
require("config.inc.php");
if (isset($_GET["Pos"]))
{$Pos=$_GET["Pos"];}
else
{$Pos="";}
$query = "select * from tblphotos where Id=$Pos";
$result = mysql_query($query) or die ("Execution de la reqête impossible");
$Ref_img=mysql_result($result,0,"Ref_Image");
$Leg_img=mysql_result($result,0,"Legende_Image");
$Id_Theme=mysql_result($result,0,"Index_Theme");
//infos sur le thème en cours
$chaine="SELECT Legende_Theme FROM tblTheme WHERE Index_Theme=$Id_Theme";
$request = MYSQL_QUERY($chaine);
$nom_themeencours = mysql_result($request,0,"Legende_Theme");
echo "   <a href=Themes.php><big><big>Themes</big></big></a> <<<  <a href=Photos.php?theme=$Id_Theme><big><big>$nom_themeencours</big></big></a><BR><BR>";
//RECHERCHE IMAGE DEMANDEE
$chaine="select * from tblPhotos where Id=$Pos";
$request= mysql_query($chaine) or die ("Execution de la reqête impossible");
$theme=mysql_result($request,0,"Index_Theme");
//RECHERCHE IMAGE PRECEDENTE
$chaine="select Id from tblPhotos where Index_Theme= $theme AND Id < $Pos ORDER by ID DESC";
$list_avant = mysql_query($chaine) or die ("Execution de la reqête impossible AVANT ");
$nb_img_avant = mysql_num_rows($list_avant);
if($nb_img_avant>0) {$id_img_avant=mysql_result($list_avant,0,"Id");}
//IMAGE AFFICHEE
$num_img_current=$nb_img_avant+1;
//RECHERCHE IMAGE SUIVANTE
$chaine="select Id from tblPhotos where Index_Theme= $theme AND Id > $Pos ";
$list_apres = mysql_query($chaine) or die ("Execution de la reqête impossible APRES");
$nb_img_apres = mysql_num_rows($list_apres);
if($nb_img_apres>0) {$id_img_apres=mysql_result($list_apres,0,"Id");}
//RECHERCHE NOMBRE PHOTOS TOTALES DU THEME SELECTIONNE
$chaine="select * from tblPhotos where Index_Theme= $theme ORDER by Id DESC";
$list_img = mysql_query($chaine) or die ("Execution de la reqête impossible ENCOURS");
$nb_img = mysql_num_rows($list_img);
echo "<center>";
echo" <big><big>$Leg_img</big></big><BR><BR>";
//AFFICHAGE SIGNE IMAGE PRECEDENTE
if ($nb_img_avant>0)
{
echo "<a href=Photos_Vue.php?Pos=$id_img_avant><img border=0 src=prec.png></a>   ";
}
//AFFICHAGE SIGNE IMAGE SUIVANTE
if ($nb_img_apres>0)
{
echo "   <a href=Photos_Vue.php?Pos=$id_img_apres><img border=0 src=suiv.png></a>";
}
//AFFICHAGE PHOTO DEMANDEE
echo "<BR><br><Img border=3 src=Photos/$Ref_img ></center>";[/php]