0
I have the following problem. I want to get when I click on a div, a value of an array. That is, I query my table, to get the value. The problem is I always have the first value. Here is the function that makes 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 I always have the same div being generated. I can’t tell which one to click on.
you want to show the value corresponding to a
<div>
which is stored in a database when a click on it?– CIRCLE
Okay, the problem is that a div is made whenever I add an event to the database. I want to know when I click on the div, send something to another page to know and then change that register, and not just the first. which is what’s happening.
– akm
make a
var_dump($array_resultados)
to see what is being brought from the database– CIRCLE
yes inside the array I have the data.
– akm
$value['title']
is always printing the same value?– CIRCLE
No, print the values right in the database.
– akm