<?php

echo '<p><b>Mise à jour de la base de données <i class="fas fa-angle-double-right"></i> Version 0.49</b></p>
<ul class="maxwidth">';

//Nettoyage de la table _edtevent
$edtevents = mysqli_query($bdd,"SELECT * FROM ".$prefix."_edtevent");
$nbev=0;
foreach($edtevents as $edtevent) {
	if(mysqli_num_rows(mysqli_query($bdd,"SELECT * FROM ".$prefix."_espaces_event WHERE uid = '".$edtevent['uid']."'"))==0||mysqli_num_rows(mysqli_query($bdd,"SELECT * FROM ".$prefix."_userevent WHERE uid = '".$edtevent['uid']."'"))==0) {
		mysqli_query($bdd,"DELETE FROM ".$prefix."_edtevent WHERE uid = '".$edtevent['uid']."'");
		$nbev++;
	}
}
echo '<li>Nettoyage de la table _edtevent ('.$nbev.').</li>';

// version bdd :
mysqli_query($bdd,"UPDATE ".$prefix."_parametres SET valeur = '0.49' WHERE param_nom = 'version_bdd'");
echo '<li>Mise à jour de la base de données effectuée - version_bdd 0.49.</li></ul>';
?>