Mysql Escape String Youtube Embed Code Not Working

srkotb40

New Member
I'm trying to do one thing and one thing only.\[code\]$embedCode = mysql_real_escape_string('<object width="270" height="227"><param name="movie" value="http://www.youtube.com/v/pz-VWi5-tGA?fs=1&hl=en_US&rel=0"></param><param name="allowFullScreen" value="http://stackoverflow.com/questions/3562480/true"></param><param name="allowscriptaccess" value="http://stackoverflow.com/questions/3562480/always"></param><embed src="http://www.youtube.com/v/pz-VWi5-tGA?fs=1&hl=en_US&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="270" height="227"></embed></object>');\[/code\]now if I write...\[code\]echo 'CODE = ' . $embedCode;\[/code\]I get...\[code\]CODE = \[/code\]Nothin...Thoughts?EDIT:Ok, so my intention isn't to just print $embedCode, it's to insert it into a database, but I'm getting a null value. I figured I'd be a smart ass and it backfired with my simplistic approach here. Anyway, the point is, It's not getting through my mysql query. EDIT 2:I'm using wordpress' $wpdb object\[code\]function insert_video(){ global $wpdb; $wpdb->show_errors(); $table_name = $wpdb->prefix . "video_manager"; $embedCode = mysql_real_escape_string('<object width="270" height="227"><param name="movie" value="http://www.youtube.com/v/pz-VWi5-tGA?fs=1&hl=en_US&rel=0"></param><param name="allowFullScreen" value="http://stackoverflow.com/questions/3562480/true"></param><param name="allowscriptaccess" value="http://stackoverflow.com/questions/3562480/always"></param><embed src="http://www.youtube.com/v/pz-VWi5-tGA?fs=1&hl=en_US&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="270" height="227"></embed></object>'); $title = 'this is my title'; $description = 'this is my description'; $wpdb->insert( $table_name, array( 'title' => mysql_real_escape_string($title), 'embed_code' => $embedCode, 'description' => mysql_real_escape_string($description) ) );}function get_video_block($id){ insert_video(); global $wpdb; $wpdb->show_errors(); $table_name = $wpdb->prefix . "video_manager"; $query = "SELECT * FROM " . $table_name . " WHERE `index` = '$id'"; $results = $wpdb->get_results($query, ARRAY_A); $results = $results[0]; $returnString = $results['title'] . '<br>'; $returnString .= $results['embed_code'] . '<br>'; $returnString .= $results['description'] . '<br>'; return $returnString;}\[/code\]and getting the result:\[code\]this is my title<br><br>this is my description<br>\[/code\]
 
Back
Top