Gestion

Gestion

[insert_php]
include(‘Ancien/Bidon/config.php’);
//try
{
$bdd = new PDO(‘mysql:host=ikebana-eota.eu.mysql;dbname=ikebana_eota_eu;charset=utf8’, ‘ikebana_eota_eu’, $SQLpass);
}
/*
catch(Exception $e)
{
die(‘Erreur : ‘.$e->getMessage());
}
*/
$groupe = $_POST[‘groupe’];
echo ‘Le groupe est : ‘ . $groupe;
$gr = $groupe;
function LireTable($bdd,$LaTable,$Nb,$array,$gr)
{
echo ‘La table ‘ . $LaTable . ‘ Nombre :’ . $Nb;
//$sql = “SELECT * FROM $LaTable where groupe like $gr”;
if ($gr > 99)
{
$sql = “SELECT * FROM $LaTable” ;
}
else
{
$sql = “SELECT * FROM $LaTable where groupe like $gr”;
}

//try
{
$stmt = $bdd->prepare($sql, array(PDO::ATTR_CURSOR, PDO::CURSOR_SCROLL));
$stmt->execute();
//$stmt= $bdd->query(“SELECT * FROM $LaTable”);
//while ($row = $stmt->fetch())
for ($i=0; $i<$Nb; $i++) { echo ' ‘ . $array[$i] . ‘

‘;}
while ($row = $stmt->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_NEXT))
{
//$data = $row[0] . “\t” . $row[1] . “\t” . $row[2] . “\n”;
echo ‘‘;
for ($i=0; $i<$Nb; $i++) { echo ' ‘ . $row[$i] . ‘

‘;}
echo ‘‘;
//print $data;
}
$stmt = null;
$sql = null;
}
/*catch (PDOException $e)
{
print $e->getMessage();
}
*/
}

[/insert_php]





lister.html

[insert_php]
echo “Liste des cours :\n
“;
$label1 = array(‘Id’,’Groupe’,’Cours’,’Professeur’,’Horaire’,’Jour’,’Niveau’,’Nb Stagiare’);

$LaTable = ‘cours’;
$Nb = 8;
LireTable($bdd,$LaTable,$Nb,$label1,$groupe);
[/insert_php]

[insert_php]
print “Liste des Adherents :\n
“;

$label2 = array(‘Id’,’Nom’,’Prenom’,’Adresse’,’Langue’,’Ville’,’Email’,’Telephone’,’Groupe’);
$LaTable = ‘liste’;
$Nb = 9;
LireTable($bdd,$LaTable,$Nb,$label2,$groupe);
[/insert_php]