I have this code:
$vid_length = gmdate("H:i:s", $ytarr['length_seconds']);
$query = $conn->prepare("INSERT INTO videos (owner_id, video_url, vid_length, thumbnail_url, title) VALUES (:owner_id, :video_url :vid_length, :thumbnail_url, :title) ");
$query->execute(array(
':owner_id' => $_POST['owner_id'],
':video_url' => $youtube_link,
':vid_length' => $vid_length,
':thumbnail_url' => (string) $ytarr['thumbnail_url'],
':title' => (string) $ytarr['title']
));
If I remove the code related to vid_length, the other values get stored fine. With vid_length in however, the query doesn't work.
I tried making the vid_length column time, datetime and also varchar/text while casting (string) to $vid_length.
Any suggestions to make this work?
Ps: $vid_length becomes of format 00:02:39 (after converting the seconds) $ytarr['length_seconds'] is a number (ie 264s seconds)