I have a JavaScript timer on a PHP page. It returns a number, representing seconds, that I want to insert into a database column of type Time
. How can I do that?
This code is the best I could find:
$query = "INSERT INTO #__quiz_r_student_question (c_stu_quiz_id,
c_question_id,
c_score,
c_attempts,
is_correct,
time_to_solve
)" .
"\n VALUES('".$stu_quiz_id."',
'".$quest_id."',
'".$c_quest_score."',
'".($c_quest_cur_attempt + 1)."',
'".$is_correct."',
DATEADD(ms, ".$time_to_solve."* 1000, 0)
)";