I have the following problem. I want to get when I click a div, a value of an array. In other words, I make a query to my table, to get the value. The problem is that I always have the first value. Here is the function that does the query
function select($dir, $base, $i){
//for($y=$arraylenght; $y>0; $y--){
$array_resultados = array(); //array
$arraylenght =15;
for($y=1; $y<=$arraylenght; $y++){
$base_hndl = new SQLite3($dir.$base);
$requete = "SELECT id, title, start, end, description, jour, mois, annee, date
FROM \"event\"
WHERE jour=\"$i\"
AND id=$y";
$resultat = $base_hndl->query($requete);
$affiche = $resultat->fetchArray();
array_push($array_resultados, $affiche); //insert in array
}
return $array_resultados;
}
And the div
if($day==$i)
{
$array_resultados = array(); //array
//function pour montrer les evenements dans le array
$array_resultados=select($dir, $base, $i);
$titles = ""; //variable inicialize
foreach($array_resultados as $key =>$value){
$titles .= "<div class=dois onclick='popup(\"_popup_cal.php?jour=$i&moisEcris=$months[$moisaff]&annee=$year&mois=$month&txttitle=$txttitle&txtstart=$txtstart&txtend=$txtend&txtdescription=$txtdescription&maj=$maj&clean=1&teste=$txttitle\",400,300)';>
".$value['title'].
"</div>"; //save in variable value
}
}
The problem is that I always have the same div to be generated. I can not distinguish where I click.