I've got a problem in my PHP code.
My original code was :
$listehoraires = $dbco->prepare("SELECT numero, horaire from `horaires`");
$listehoraires -> execute();
foreach ($listehoraires as $numero => $horaire) {
$_SESSION['horaires'] += [$numero => $horaire];
}
Now, I need to select 3 fields in a database table :
$listehoraires = $dbco->prepare("SELECT numero, actif, horaire from `horaires`");
$listehoraires -> execute();
"actif" (=active) is used as a boolean to know if I add $numero and $horaire at the session variable and contains "yes" or "no".
I want to have something like :
foreach ($listehoraires as $numero => $horaire) {
if ($actif == 'yes') $_SESSION['horaires'] += [$numero => $horaire];
}
but I don't know how to write it.
Any idea ?