I'm retriving a youtube link from mysql db with this code
<?php
//echo $embed;
$yt_url=$embed;
function get_youtube_id_from_url($url)
{
if (stristr($url,'youtu.be/'))
{ preg_match('/(https|http):\/\/(.*?)\/([a-zA-Z0-9_]{11})/i', $url, $final_ID);return $final_ID[3]; }
else
{ preg_match('/(https|http):\/\/(.*?)\/(embed\/|watch\?v=|(.*?)&v=|v\/|e\/|.+\/|watch.*v=|)([a-zA-Z0-9_]{11})/i', $url, $IDD); return $IDD[5]; }
}
$variable= get_youtube_id_from_url($yt_url);
?>
and extracting the id part of the link and placing it in this piece of code below
echo "<div align='center'><iframe src=\"//www.youtube.com/embed/" . $variable. "\" style=\"background: #fff;\" frameborder=\"0\" height=\"300\" scrolling=\"auto\" width=\"480\"></iframe></div>";
but am told the vedio dose not exit, please help