I couldn't find help anywhere about how to insert a specific time I need to mysql using php.
I tried creating a column type varchar, and submit a regular input value with php $_POST['hour'], but I got a error
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1', '7:30pm', '', '', ')' at line 1
I just need to know what type of column I should create and if there's a built-in function to get the time I need when submit, so I can store that hour and minutes, and NOT the current time, as all other posts are about.
My code:
if($_SERVER['REQUEST_METHOD'] == "POST") {
$days_1 = isset($_POST['day_1']);
$hours_1 = $_POST['hours_1'];
}
$sql = "INSERT INTO table(day_1, hours_1)";
$sql.= " VALUES('$day_1', '$hours_1')";
HTML FORM
<select id="hoursMonday" name="hours_1" class="form-group mb-4">
<option value=""></option>
<option value="7:30pm">7:30pm</option>
<option value="8:00pm">8:00pm</option>
</select>