<!--#include file="/include/connection.inc" -->
	'Establish DB connection
<?php
$servername = "75.103.66.12";
//$username = "boatauto_boataut";
$username = "boatauto_rascal";
//$username = "boatauto_jojo";

$password = "boat2014";
//$password = "jojo2959";
$dbname = "boatauto_test";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
//$conn = new mysqli($servername, $username, $password);


if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
echo "Connected successfully";
echo "<br>";
<%
If Request("bid") = "" Then
	boat_id = 0
ELSE
	boat_id = Request("bid")
END IF

If Request("b1") = "" Then
	batt1_value = 0
ELSE
	batt1_value = Request("b1")
END IF
If Request("b2") = "" Then
	batt2_value = 0
ELSE
	batt2_value = Request("b2")
END IF
If Request("b3") = "" Then
	batt3_value = 0
ELSE
	batt3_value = Request("b3")
END IF
If Request("b4") = "" Then
	batt4_value = 0
ELSE
	batt4_value = Request("b4")
END IF
If Request("t1") = "" Then
	temperature1 = 0
ELSE
	temperature1 = Request("t1")
END IF
%>
//$sql = "insert_boatauto_info()";
//$sql = mysql_query('CALL insert_boatauto_info(1);');
//$sql = "INSERT INTO MyGuests (firstname, lastname, email) VALUES ('John', 'Doe', 'john@example.com')";
$sql = "INSERT INTO  `boatauto_test`.`boat_data` (
`boat_id' ,
`time_recorded` ,
`batt1_value` ,
`batt2_value` ,
`batt3_value` ,
`temperature1` ,
`temperature2` ,
`button_1` ,
`button_2` ,
`button_3` ,
`button_4` ,
`button_5` ,
`button_6` ,
`serial_output`
)
VALUES (
boat_id , TIMESTAMP( 
CURRENT_TIMESTAMP ) ,  batt1_value,  batt2_value,  batt3_value,  batt4_value,  temperature1,  temperature2,  1,  0,  1,  1,  0,  'This is a test insert'
)";
if ($conn->query($sql) === TRUE) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}
$sql = "SELECT * FROM  `boat_data` ";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
//        echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
echo "<br>";
echo "transaction_id: " . $row["transaction_id"]. " - boat_id: " . $row["boat_id"]. " - time_recorded: " . $row["time_recorded"] 
. " - batt1_value: " . $row["batt1_value"]
. " - batt2_value: " . $row["batt2_value"]
. " - batt3_value: " . $row["batt3_value"]
. " - temperature1: " . $row["temperature1"]
. " - temperature2: " . $row["temperature2"]
. " - button_1: " . $row["button_1"]
. " - button_2: " . $row["button_2"]
. " - button_3: " . $row["button_3"]
. " - button_4: " . $row["button_4"]
. " - button_5: " . $row["button_5"]
. " - button_6: " . $row["button_6"]
. " - serial_output: " . $row["serial_output"];

    }
} else {
    echo "0 results";
}
$conn->close();
?>