1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| <?php
header('Content-type: text/html; charset=iso-8859-1');
header('Cache-Control: no-cache');
// echo '<err>';
$profondeur = $_GET['profondeur'];
$duree = $_GET['duree'] * 60; // duree convertie en seconde
//ici les parametres pour la connexion
$host="sql.free.fr";
$base="*********";
$passe="********";
//on effectue la connexion
$link = mysql_connect("$host","$base","$passe") or die ("Echec de connexion à la base") ;
//Selection de la base de données qui porte le meme nom que votre login
$select_base=@mysql_selectdb("$base") or die ("Echec de selection de la base");
// Recherche de la profondeur
$sql = "SELECT MIN(Profondeur) As Profondeur FROM T_TABLE_PLONGEE WHERE Profondeur >= " . $profondeur;
$result = mysql_query($sql) or die("Query failed : " . $sql);
$line = mysql_fetch_assoc($result);
// Liberation des resultats
mysql_free_result($result);
$profondeurTable = $line["Profondeur"];
if ($profondeurTable == "") {
$err = "Profondeur hors table";
}
// Recherche de la duree
$sql = "SELECT MIN(Duree) AS Duree FROM T_TABLE_PLONGEE WHERE Duree >= SEC_TO_TIME(" . $duree . ") AND Profondeur = " . $profondeurTable ;
$result = mysql_query($sql) or die("Query failed : " . $sql);
$line = mysql_fetch_assoc($result);
$dureeTable = $line["Duree"];
// Liberation des resultats
mysql_free_result($result);
if ($dureeTable == "") {
$err = "Hors table";
}
$sql = "SELECT Palier3m, Palier6m, Palier9m, Palier12m, DTR, GroupePlongee
FROM T_TABLE_PLONGEE
WHERE Profondeur = " . $profondeurTable . " AND Duree = '" . $dureeTable . "'";
$result = mysql_query($sql) or die("Query failed : " . $sql);
$line = mysql_fetch_assoc($result);
// Liberation des resultats
mysql_free_result($result);
// Fermeture de la connexion
mysql_close($link);
echo $err . '-' . $profondeurTable . '-' . $dureeTable . '-' . $line["Palier3m"] . '-' .
$line["Palier6m"] . '-' . $line["Palier9m"] . '-' . $line["Palier12m"] .
'-' . $line["DTR"] . '-' . $line["GroupePlongee"];
?> |