
<html>
<head>
	<meta charset="utf-8" />
</head>

<body>
<?php
// Connexion … mysql
if($Numco=mysql_connect("localhost","root",""))
{
echo "Connexion serveur OK <br>"; // Alors connexion serveur
// Selection de la base de donn‚ess
if ($NumBdd=mysql_select_db ("texier"))
{echo "Selection BDD OK <br>";
//On test l'extraction des donn‚es
if($result = mysql_query("SELECT * FROM data "))
{echo "Table BDD OK <br>";

$dateHasard = mktime(0, 0, 0, 1, 1, 2016);
//echo $dateHasard;
//echo date("Y-m-d h:m:s",1451602800);
//format timeStamp MySQL : AAAA-MM-DD HH:MM:SS
// format timeStamp PHP : 1451602800
$ExtHasard;
$humidHasard;
for($Cmpt=25000;$Cmpt>1;$Cmpt--)
{
$dateHasard = $dateHasard + 900; // données tous les 15 mn
echo $dateHasard."<br>";
//echo date("Y-m-d h:i:s",$dateHasard)."<br>";
$ExtHasard=rand ( -5 , 30 );
$humidHasard=rand ( 30 , 80 );
$requete="INSERT INTO data (dateT,tempExt,humidExt) VALUES ('".$dateHasard."','".$ExtHasard."','".$humidHasard."')";
mysql_query($requete);
}
}
else
{
echo "<p>Extraction des donnees impossible</p>";
}
}
else // Sinon connexion base
{
echo " <p>Base de donnees introuvable <br></p>";
}
}
else
{
echo "<p> Connexion SERVEUR impossible <br></p>";
}
mysql_close($Numco);
?>
</body>
</html>