Rev 1996 | Rev 1998 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
class Dao extends Bdd {
public function obtenirObservationsSauvages() {
$requete = 'SELECT * FROM cel_obs '.
'WHERE mots_cles_texte LIKE "%sauvages%" '.
'AND mots_cles_texte LIKE "%Projets coopératifs%" ';
$resultat = $this->recupererTous($requete);
return $resultat;
}
public function ajouterChampsEtendusParLots($obs_a_champs_etendus) {
$lignes = array();
foreach ($obs_a_champs_etendus as $champs_etendus_obs) {
foreach ($champs_etendus_obs as $champ_etendu) {
$id = $this->proteger($champ_etendu['id_observation']);
$cle = $this->proteger($champ_etendu['cle']);
$label = $this->proteger($champ_etendu['label']);
$valeur = $this->proteger($champ_etendu['valeur']);
$lignes[] = "($id, $cle, $label, $valeur)";
}
}
$requete = "INSERT INTO cel_obs_etendues (id_observation, cle, label, valeur) ".
"VALUES ".implode(',', $lignes)." ON DUPLICATE KEY UPDATE valeur = VALUES(valeur) -- ".__FILE__.' '.__LINE__;
// la partie on duplicate key est spécifique mysql mais il sera facile de s'en passer le jour
// où l'on change de sgbd
$ajout = $this->requeter($requete);
return ($ajout !== false);
}
}
?>