It's a portfolio with 4 section. Each page has 1 category, that category has 4 projects represented by 4 links. This is my list of links/projects (extracted from database), and appearing via a loop :
<?php
$x = 0;
while ($x < 16){
if (($categories[$x] == $section) && (isset($categories[$x])))
{
echo '<li><a href="#'.$ids[$x].'" class="close";">'.$titres[$x].'</a></li>';
}
}
$x++;
?>
Each links makes appear a description, which also comes from my database via this loop :
<?php
$x = 0;
while ($x < 16)
{
if (($categories[$x] == $section) && (isset($categories[$x])))
{
echo '<p id="'.$x.'" class="description"> '.$description[$x].'</p>';
}
$x++;
}
?>
HERE IS MY PROBLEM : By clicking on the link's project appears : - the right description appears, - and the picture of the project too. . I tried to find a jquery way .. but give up .. i tried with javascript .. doesn't work. I about to break my laptop.
DETAILS : My database only has 1 table with everything included.
$sql = "SELECT categorie FROM Projets WHERE categorie=".$categorie;
$tabCat = getCategorie($categorie);
$categories = array();
$titres = array();
$description = array();
$images = array();
$ids = array();
$i = 0;
while ($donnees = $tabCat->fetch())
{
$categories[$i] = $donnees['categorie'];
$titres[$i] =$donnees['Titre'];
$description[$i] = $donnees['Description'];
$images[$i] = $donnees['Image'];
$ids[$i] = $donnees['id'];
$i++;
}
$tabCat->closeCursor(); // Termine le traitement de la requête
?>
I'm not sure of what you are trying to accomplish here but I see some errors in your code anyways, in your first code class="close";">
you seem to have a double quote too much and also what is the ;
doing in there? In that same file, you've put your $x++;
outside of your loop, so it will never be incremented inside the loop...
I still find your question confusing in what you are trying to accomplish here, can you be more specific to your problem? Tu peux toujours poser ta question en français aussi, si ça peut t'aider...