<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<head>
<title>Transfert SQL</title>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<body>
<?php
// bts2m.free.fr/Wifi/VI_recup.php?table=1
// roupet.free.fr/informatique/mysql.php
//--Connexion au serveur
define("NOM","tpil.projet"); //nom = login chez free
define("PASSE","MotDePasse"); // passe=votre mot de passe free
define("SERVEUR","sql.free.fr"); // adresse du serveur free
$link = mysql_connect(SERVEUR,NOM,PASSE);
$table='mesures';
$titre='mesuresTitre';
if(!$link) {echo"Impossible de se connecter au serveur".mysql_error();exit;}
else {echo "<h2>Connexion au serveur réussie !</h2>\n";}
if (isset($_GET['table'])) {
$table='mesures'.$_GET['table'];
$titre='mesuresTitre'.$_GET['table'];
echo "<p>Table : ".$table." Titre : ".$titre."</p>\n";
}
mysql_select_db($titre,$link);
$requete= "SELECT * FROM ".$titre." ORDER BY `id` ASC";
if ($reponse=mysql_query($requete, $link)) {
$ligne=mysql_fetch_array($reponse, MYSQL_ASSOC);
echo "<p>TitreM1=".$ligne[titre].". UnitM1=".$ligne[unit]."</p>\n";
$ligne=mysql_fetch_array($reponse, MYSQL_ASSOC);
echo "<p>TitreM2=".$ligne[titre].". UnitM2=".$ligne[unit]."</p>\n";
$ligne=mysql_fetch_array($reponse, MYSQL_ASSOC);
echo "<p>TitreM3=".$ligne[titre].". UnitM3=".$ligne[unit]."</p>\n";
}
else // Sinon, on affiche un message d'erreur
{echo '<p>Pas de transmission</p><p>Rappel format : /Wifi/VI_recup?table=1</p>\n';}
mysql_close($link);
?>
</body>
</html>