<?php

function afficheInfos($key, $value)
{
	if ($key != "id" ) {
		echo "<p id='{utf8_encode($key)}' class='nomChamp'>".($key)."</p>";
		echo "<p>".($value)."</p>";
	}
}

$id = $_GET['id'];

$db = mysql_connect('localhost', 'root', 'm148r43a9Y@%Z')  or die ('Erreur de connexion '.mysql_error());

mysql_select_db('smartpassTest2',$db) or die ('Erreur de selection '.mysql_error());

$sql = "SHOW TABLES FROM smartpassTest2";
$tables = mysql_query($sql);

echo'
	 <!DOCTYPE html>
        <head>
          <title>Fiche point</title>
          <link rel="stylesheet" href="style.css">
          <meta charset="UTF-8">
        </head>';

echo "<a href='points.php'>Accueil</a>";
echo "<a href='confSuppression.php?id={$id}'>Supprimer</a>";
echo "<a href='mdfForm.php?id={$id}'>Modifier</a>";

echo "<h1>Infos du point</h1>";	

while ($row = mysql_fetch_row($tables)) {
	if($row[0]!="Parcours" and $row[0]!="ips"){
		$sql = "SELECT * FROM {$row[0]} WHERE id = {$id}";
		$data = mysql_fetch_array(mysql_query($sql));
		foreach ($data as $key => $value) {
			if (!is_null($value) and !is_integer($key)) {
				afficheInfos($key,$value);
			}
		}
	}		
}

?>
