i am trying to save data from frontend , i have a repeater in profile user where i save many videos as repeater.
when i insert from backend it works perfect , but when i do it in frontend with the update_field function , when theres no video previous , the data is stored wrong see the attach image. this is my code
$user_id = $current_user->ID;
if(have_rows(‘videos’, ‘user_’.$current_user->ID))
$videos = get_field(‘videos’, ‘user_’.$current_user->ID);
else
$videos = array();
//insert video to array
if($video_url != “”)
{
$videos[] = array( ‘url_video’ => $video_url , ‘title_video’ => ”, ‘file_path’ => ” );
update_field(“videos”, $videos, ‘user_’.$current_user->ID);
}
when i use this and the data is empty it saves bad in the database, but if exists 1 video and save in frontend the data is stored good , see the attach and you understand