<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8"/>
		<title>Gestion des Points</title>
		<link rel="shortcut icon" type="image/x-icon" href="../mmd/favicon.ico"/>
		<link rel="stylesheet" href="../style.css">
		<link rel="stylesheet" href="style.css">
		<script type="text/javascript" src="jquery.js"></script>
	</head>

<?php

function afficheInfos($key, $value)
{
	echo '<tr>';
	if ($key != "id" ) {
		echo "<th id='{utf8_encode($key)}'>".($key)."</th>";
		echo "<td>".($value)."</td>";
	}
	echo '</tr>';
}

$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 "<a href='mdfForm.php?id={$id}'><img src='edit.svg' alt='' style='width:50px;position:absolute;top:50px;right:120px'/></a>";
echo "<a href='confSuppression.php?id={$id}'><img src='delete.svg' alt='' style='width:50px;position:absolute;top:50px;right:50px'/></a>";

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

echo '<table>';

while ($row = mysql_fetch_row($tables)) {
	if($row[0]!="Parcours" and $row[0]!="ips" and $row[0] != "photos"){
		$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);
			}
		}
	}		
}

echo '</table>';

?>

		<a href="index.php"><div class="back_arrow"></div></a>
		<style type="text/css">
		.back_arrow {
			background: url('../mmd/return.svg') no-repeat center;
			cursor: pointer;
			position: absolute;
			top: 50px;
			left: 50px;
			width: 50px;
			height: 50px;
			opacity: 1;
		}

		.back_arrow:hover {
			opacity: 0.5;
		}
		</style>