i want to show a video from a url that its stored on the database. What am i doing wrong

 <object width="620" height="320" data="<?php echo $profileurl;?>">
            </object>

the string works because when i use it it appears e.g. https://www.youtube.com/watch?v=DbVkiN0Zip4

Recommended Answers

Can you elaborate on what you mean by "the string works" please? Do you mean that the $profileurl variable is having the video URL placed in it?

I'm pretty sure that isn't correct code for embedding YouTube URL's. Looking at the code that YouTube itself gives when you select …

Jump to Post

All 3 Replies

Can you elaborate on what you mean by "the string works" please? Do you mean that the $profileurl variable is having the video URL placed in it?

I'm pretty sure that isn't correct code for embedding YouTube URL's. Looking at the code that YouTube itself gives when you select the embed option, it's an iframe:

<iframe width="560" height="315" src="//www.youtube.com/embed/0aaAX_TYwl4" frameborder="0" allowfullscreen></iframe>

That would make your embed script something like:

<iframe width="560" height="315" src="<?php echo $profileurl;?>" frameborder="0" allowfullscreen></iframe>

You would need to change the way the video URL is stored in the database though to include the /embed/ part.

its ok Borzoi i got it man. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.