Page 1 of 1

Putting a youtube url in a database

Posted: Wed Sep 18, 2013 2:02 am
by chris98
How could I succesfully put a youtube embedded code in a database?

For example, I would want something like this:

Code: Select all

<iframe width="640" height="360" src="//www.youtube.com/embed/meuM8oKDvpo?feature=player_detailpage" frameborder="0" allowfullscreen></iframe>

Every time I try in a <textarea> to paste this in, it doesn't allow it.So I have created a seperate column in my database for it, called youtube_vid.And then I just pasted it into an <input>, which allowed it.

Now, it works, but everything below it just dissapears.I have checked using the f12 tools, and the source says it is still there, yet it is not visible on the page.However, it does show this:

Is the problem because there is no ">" tag after the embed?

Code: Select all

<a id="watch"><iframe width="640" height="360" src="//www.youtube.com/embed/meuM8oKDvpo?feature=player_detailpage"        	<p>&nbsp;</p>
			<h2>Information by <font color="red"><a href="mailto:lordchris@strongholdheaven.co.uk">Lord_Chris</a></font></h2>
</p>
I have tried adding one, and then even that <embed> doesn't work.

What could I do?

Re: Putting a youtube url in a database

Posted: Wed Sep 18, 2013 2:49 am
by requinix
Your database isn't allowing for anything longer than 100 characters. You'll have to lengthen that to something; kinda sounds like you should have a high limit like a TEXT (64k).

Re: Putting a youtube url in a database

Posted: Wed Sep 18, 2013 9:37 am
by chris98
Ah, thank you.That's all it was, & it is now showing the full information.

Re: Putting a youtube url in a database

Posted: Tue Sep 24, 2013 4:54 am
by priyankagound
Try out this one.

For example, if the URL to the video a user wants to post is https://www.youtube.com/watch?v=0TL5CSPFzTU then they would just enter 0TL5CSPFzTU and you would output your code as such:

echo '<iframe width="560" height="315" src="https://www.youtube.com/embed/' . stripslashes($row['videourl']) . '" frameborder="0" allowfullscreen></iframe>';