Tresorfinder Ergebnis
[insert_php]
$servername = „rdbms.strato.de“;
$username = „U2766275“;
$password = „pf45frR58fT1“;
$dbname = „DB2766275“;
// Input variables
$privatOrCommercial = $_POST[‚privatOrCommercial‘];
$ensurance_by = $_POST[‚ensurance_by‘];
$ensurance_until = $_POST[‚ensurance_until‘];
$ensurance_temp = 0;
$fireprotect = $_POST[‚fireprotect‘];
$outer_height = $_POST[‚outer_height‘];
$outer_width = $_POST[‚outer_width‘];
$outer_depth = $_POST[‚outer_depth‘];
$inner_height = $_POST[‚inner_height‘];
$inner_width = $_POST[‚inner_width‘];
$inner_depth = $_POST[‚inner_depth‘];
$index_count = 0;
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die(„Verbindungsfehler! Versuchen Sie es später noch einmal: “ . $conn->connect_error);
}
$sql = „SELECT * FROM safe_data“;
$result = $conn->query($sql);
//Checks if there are databank rows as result
if ($result->num_rows > 0) {
echo“
„;
//echo“
Von uns empfohlene Tresore für Sie…
„;
echo“
„;
echo“
„;
if($fireprotect != 0){
// output data of each row
while($row = $result->fetch_assoc()) {
// check and set insurance value
if ($privatOrCommercial == 1) {
$ensurance_temp = $row[„insurable_privat“];
}
else if ($privatOrCommercial == 2) {
$ensurance_temp = $row[„insurable_com“];
}
//if ($row[„out_height“] < $outer_height && $row["out_width"] < $outer_width && $row["out_depth"] < $outer_depth && $row["inner_height"] < $inner_height && $row["inner_width"] < $inner_width && $row["inner_depth"] < $inner_depth) {
if (($row["out_height"] <= $outer_height && $row["out_width"] <= $outer_width && $row["out_depth"] <= $outer_depth && $row["inner_width"] <= $inner_width && $row["inner_depth"] <= $inner_depth && $row["inner_height"] <= $inner_height) && ($ensurance_temp == $ensurance_by || $ensurance_temp <= $ensurance_until && $ensurance_temp >= $ensurance_by && $ensurance_temp != 0 )) {
if($row[„id“] >= 158 && $row[„id“] <= 163){
writeTable($row, $privatOrCommercial);
echo"Alle Informationen zum Tresor finden Sie hier „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 164 && $row[„id“] <= 169){
writeTable($row, $privatOrCommercial);
echo"Alle Informationen zum Tresor finden Sie hier „;
echo“
„;
//increase index for result 0
$index_count++;
}
}
}
}
else {
while($row = $result->fetch_assoc()) {
// check and set insurance value
if ($privatOrCommercial == 1) {
$ensurance_temp = $row[„insurable_privat“];
}
else if ($privatOrCommercial == 2) {
$ensurance_temp = $row[„insurable_com“];
}
//if ($row[„out_height“] < $outer_height && $row["out_width"] < $outer_width && $row["out_depth"] < $outer_depth && $row["inner_height"] < $inner_height && $row["inner_width"] < $inner_width && $row["inner_depth"] < $inner_depth) {
if (($row["out_height"] <= $outer_height && $row["out_width"] <= $outer_width && $row["out_depth"] <= $outer_depth && $row["inner_width"] <= $inner_width && $row["inner_depth"] <= $inner_depth && $row["inner_height"] <= $inner_height) && ($ensurance_temp == $ensurance_by || $ensurance_temp <= $ensurance_until && $ensurance_temp >= $ensurance_by && $ensurance_temp != 0)) {
if($row[„id“] <= 6){
writeTable($row, $privatOrCommercial);
echo"Zu Wertschutzschränken Klasse 0 „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 7 && $row[„id“] <= 13){
writeTable($row, $privatOrCommercial);
echo"Zu Wertschutzschränken Klasse I „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 20 && $row[„id“] <= 26){
writeTable($row, $privatOrCommercial);
echo"Zu Wertschutzschränken Klasse II „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 33 && $row[„id“] <= 40){
writeTable($row, $privatOrCommercial);
echo"Zu Wertschutzschränken Klasse III „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 48 && $row[„id“] <= 54){
writeTable($row, $privatOrCommercial);
echo"Zu Wertschutzschränken Klasse IV „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 62 && $row[„id“] <= 68){
writeTable($row, $privatOrCommercial);
echo"Zu Wertschutzschränken Klasse V „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 76 && $row[„id“] <= 81){
writeTable($row, $privatOrCommercial);
echo"Zu Datensicherungsschränken „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 82 && $row[„id“] <= 86){
writeTable($row, $privatOrCommercial);
echo"Zu Datensicherungsschränken „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] == 87){
writeTable($row, $privatOrCommercial);
echo“Zu Aktenlagerschränken „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 88 && $row[„id“] <= 91){
writeTable($row, $privatOrCommercial);
echo"Zu Aktenlagerschränken „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 96 && $row[„id“] <= 102){
writeTable($row, $privatOrCommercial);
echo"Zu Aktenlagerschränken „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 107 && $row[„id“] <= 108){
writeTable($row, $privatOrCommercial);
echo"Zu Deposittresoren „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 109 && $row[„id“] <= 112){
writeTable($row, $privatOrCommercial);
echo"Zu Deposittresoren „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 113 && $row[„id“] <= 116){
writeTable($row, $privatOrCommercial);
echo"Zu Waffenschränken „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 117 && $row[„id“] <= 123){
writeTable($row, $privatOrCommercial);
echo"Zu Waffenschränken „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 128 && $row[„id“] <= 137){
writeTable($row, $privatOrCommercial);
echo"Zu Möbeltresoren „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 138 && $row[„id“] <= 145){
writeTable($row, $privatOrCommercial);
echo"Zu Möbeltresoren „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 146 && $row[„id“] <= 145){
writeTable($row, $privatOrCommercial);
echo"Zu Möbeltresoren „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 146 && $row[„id“] <= 149){
writeTable($row, $privatOrCommercial);
echo"Zu Möbeltresoren „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 158 && $row[„id“] <= 163){
writeTable($row, $privatOrCommercial);
echo"Zu Feuertresoren „;
echo“
„;
//increase index for result 0
$index_count++;
}
else if($row[„id“] >= 164 && $row[„id“] <= 169){
writeTable($row, $privatOrCommercial);
echo"Zu Feuertresoren „;
echo“
„;
//increase index for result 0
$index_count++;
}
}
}
}
}
if ($index_count == 0) {
//echo „0 results“;
//echo“Ich würde gerne eine neue Suche starten
„;
echo „
„;
}
function writeTable($row, $privatOrCommercial)
{
echo“
„;//beginning von table.. end is under button
echo“
„;
//echo „ id: „. $row[„id“] . „ „;
echo“
„;
echo „
Name: „. $row[„model_typ“] . „
„;
if($privatOrCommercial == 1){
echo „
Versicherbar privat bis: „. $row[„insurable_privat“] . „€“ . „
„;
}
else if($privatOrCommercial == 2){
echo „
Versicherbar gewerblich bis: „. $row[„insurable_com“] . „€“ .“
„;
}
echo“
„;
//echo“ „;
echo“
„;
//echo“
„;
echo“
Höhe (Außen): $row[out_height] mm
„;
echo“
Höhe (Innen): $row[inner_height] mm
„;
echo“
„;
echo“
„;
echo“
Breite (Außen): $row[out_width] mm
„;
echo“
Breite (Innen): $row[inner_width] mm
„;
echo“
„;
echo“
„;
echo“
Tiefe (Außen): $row[inner_width] mm
„;
echo“
Tiefe (Innen): $row[inner_depth] mm
„;
echo“
„;
echo“
„;
}
$conn->close();
[/insert_php]