RAH Posted August 14, 2007 Share Posted August 14, 2007 Hi, I've been having some difficulty getting the correct syntax for this. Let me explain the issue - the script in it's current state below is working however videoFile:"abc.com/video.flv" bit is causing an issue. It needs to be in single quotes for the flash player to play the video. However all attempts to correct this have ended up in a multitude of errors and issues. What is the correct way of achieving this? Script excerpt: @mysql_query('INSERT INTO jos_content (title, title_alias, introtext, state, sectionid, mask, catid, created, created_by, created_by_alias, modified, modified_by, checked_out, checked_out_time, publish_up, publish_down, images, urls, attribs, version, parentid, ordering, metakey, metadesc, access, hits) VALUES (\'' . $title .'\',\'' . $title .'\',\'<object type="application/x-shockwave-flash" data="player.swf" ' . ' width="320" height="262" id="FlowPlayer">' . ' <param name="allowScriptAccess" value="sameDomain" />' . ' <param name="movie" value="http://tvloser.com/videos/' . $md5 . '.flv">' . ' <param name="quality" value="high">' . ' <param name="scale" value="noScale">' . ' <param name="wmode" value="transparent">' . ' <param name="flashvars" value="config={videoFile:"http://tvloser.com/videos/' . $md5 . '.flv",autoPlay: true}">' . ' </object></textarea>' . ' </div>\', \'1\', \'2\', \'0\', \'3\', \'2007-08-10 11:54:06\', \'62\', \'\', \'0000-00-00 00:00:00\', \'62\', \'0\', \'0000-00-00 00:00:00\', \'2007-08-10 11:54:06\', \'0000-00-00 00:00:00\', \'\', \'\', \'pageclass_sfx=' . ' back_button=' . ' item_title=1' . ' link_titles=' . ' introtext=1' . ' section=0' . ' section_link=0' . ' category=0' . ' category_link=0' . ' rating=' . ' author=' . ' createdate=' . ' modifydate=' . ' pdf=' . ' print=' . ' email=' . ' keyref=' . ' docbook_type=' . ' html_title=$title' . ' robots=-1' . ' google_cache=1' . ' google_snippet=1\', \'2\', \'0\', \'1\', \'METAKEY FIELD\', \'META DESC FIELD\', \'0\', \'0\')'); } } Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted August 14, 2007 Share Posted August 14, 2007 Escaped single quotes: . ' <param name="flashvars" value="config={\'videoFile:"http://tvloser.com/videos/' . $md5 . '.flv",autoPlay: true\'}">' You cant use single quotes without escaping them, because single quotes are being used to enclose the query. Quote Link to comment Share on other sites More sharing options...
RAH Posted August 14, 2007 Author Share Posted August 14, 2007 Hi, I do believe that I've tried that already. I replaced that line with yours and the script now fails to add anything to the database and no errors even after turning on error reporting. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted August 14, 2007 Share Posted August 14, 2007 Did you try removing the error suppressant(@) and adding an or die statement? Try: $sql = 'INSERT INTO jos_content (title, title_alias, introtext, state, sectionid, mask, catid, created, created_by, created_by_alias, modified, modified_by, checked_out, checked_out_time, publish_up, publish_down, images, urls, attribs, version, parentid, ordering, metakey, metadesc, access, hits) VALUES (\'' . $title .'\',\'' . $title .'\',\'<object type="application/x-shockwave-flash" data="player.swf" ' . ' width="320" height="262" id="FlowPlayer">' . ' <param name="allowScriptAccess" value="sameDomain" />' . ' <param name="movie" value="http://tvloser.com/videos/' . $md5 . '.flv">' . ' <param name="quality" value="high">' . ' <param name="scale" value="noScale">' . ' <param name="wmode" value="transparent">' . ' <param name="flashvars" value="config={\'videoFile:"http://tvloser.com/videos/' . $md5 . '.flv",autoPlay: true\'}">' . ' </object></textarea>' . ' </div>\', \'1\', \'2\', \'0\', \'3\', \'2007-08-10 11:54:06\', \'62\', \'\', \'0000-00-00 00:00:00\', \'62\', \'0\', \'0000-00-00 00:00:00\', \'2007-08-10 11:54:06\', \'0000-00-00 00:00:00\', \'\', \'\', \'pageclass_sfx=' . ' back_button=' . ' item_title=1' . ' link_titles=' . ' introtext=1' . ' section=0' . ' section_link=0' . ' category=0' . ' category_link=0' . ' rating=' . ' author=' . ' createdate=' . ' modifydate=' . ' pdf=' . ' print=' . ' email=' . ' keyref=' . ' docbook_type=' . ' html_title=$title' . ' robots=-1' . ' google_cache=1' . ' google_snippet=1\', \'2\', \'0\', \'1\', \'METAKEY FIELD\', \'META DESC FIELD\', \'0\', \'0\')'; mysql_query($sql) or die(mysql_error().'<br /><br />Query:'.$sql); Ive assigned the query string to a variable so we can see the actual query if there is an error. Quote Link to comment Share on other sites More sharing options...
RAH Posted August 14, 2007 Author Share Posted August 14, 2007 I had removed the @ and no difference. Have used your code and got the following: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'videoFile:"http://tvloser.com/videos/b8e9a9ad19d3156ca071073f2e482a12.flv",autoP' at line 1 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.