ryan.od Posted October 1, 2006 Share Posted October 1, 2006 How do I put a YouTube embed link into a db and then use php to put the code into the page html?The issue is all the quotes. . .I'm not sure how to deal with them. Manually, I would just use \ to handle the internal quotes.Any suggestions?Here is an example: <object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/gZ5Weo7Gqws"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/gZ5Weo7Gqws" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>I want users to be able to insert these with a form, but when I try to pull them out of the db with PHP, I don't know how to deal with all the quotes. Thanks. Quote Link to comment Share on other sites More sharing options...
printf Posted October 1, 2006 Share Posted October 1, 2006 When you do the insert use![code]mysql_real_escape_string ( $tube_html_data );[/code]Then you don't have to worry about the quotes! But I would not insert all that html, I would only insert the unique data, then fill a generic html object template with that data!me! Quote Link to comment Share on other sites More sharing options...
ryan.od Posted October 1, 2006 Author Share Posted October 1, 2006 OK, that works. Unfortunately, it escapes all the quotes (great! PHP can handle them) and that is a problem when it is written in as HTML.As such, I guess I need to escape everything so the PHP can read it, then 'unescape' everything when it is written in as HTML. Not sure how this can be done. . .Thanks for your quick response. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.