<?php

function creer_table() {
    include_spip('base/db_mysql');
    include_spip('base/abstract_sql');
    include_spip('inc/presentation');

	 echo 'entrée dans la fonction creer_table<br/>';
	 
    $requete_creertable ='CREATE TABLE IF NOT EXISTS eva_mentions
    (id_mentions INTEGER NOT NULL AUTO_INCREMENT,
    eva_dir_pub TEXT NOT NULL, 
    eva_resp_redac TEXT NOT NULL,
    eva_heb_site TEXT NOT NULL,
    eva_edit_site TEXT NOT NULL,
    eva_ref_charte TEXT NOT NULL,
    PRIMARY KEY (id_mentions)
    )';
    
    $resultat_creertable = spip_query($requete_creertable);
    $enregistrement1 = "INSERT INTO eva_mentions VALUE ('','A DEFINIR','A DEFINIR','A DEFINIR','A DEFINIR','A DEFINIR')";
    $resultat = spip_query($enregistrement1);
    
    $nb = spip_num_rows($resultat);

	if ($nb == 0){
	echo _T('evainstall:la table existe d&eacute;jà');
	return;
	}
	
    debut_cadre_relief('', false, '', "Cr&eacute;ation de la Table");
    echo _T('evainstall:EVA_creation_table');
    fin_cadre_relief();

    return;
}

function effacer_table() {
    include_spip('base/db_mysql');
    include_spip('base/abstract_sql');
    include_spip('inc/presentation');
    
    $requete_efftable = 'DROP TABLE eva_mentions';
    spip_query($requete_efftable);

}
?>