I have a multidimensional array in php that look like this:
Array ( [0] => Array ( [day] => 0 [periods] => Array ( [0] => Array ( [0] => 01:00 [1] => 01:30 ) [1] => Array ( [0] => 02:30 [1] => 03:00 ) ) ) [1] => Array ( [day] => 1 [periods] => Array ( [0] => Array ( [0] => 01:30 [1] => 02:00 ) ) )
The key "day" is sent to the day, so the day [0] = "Monday" And the key "periods" repeats the hour that the user selected on the same day.
So, on day [0] there is an array of "periods" that refers to an anthor array that stores an hour, it starts at 01:00, the end is 01:30 the beginning of 02:30, the end is 03:00
I am trying to use this array but cannot find a way. I want to enter this value for each hour in mysql as follows:
$sql = "INSERT INTO task_list ( task, day, hour ) VALUES (?, ?, ?) ";
ex: day: 0 start 1:00, day: 0 end 1:30
any suggestions?
source share