Hi, The following code inserts the literal variables (physically displays variables on website, eg. $title) rather than displaying the result of the variables. How can this be corrected? { @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\')'); } } PHP: Thanks.
Variables are not parsed between single quotes. Use double quotes, or do: $query = 'INSERT INTO [...] (\'' . $title .'\', [...]'; PHP:
Thanks , that worked for $title however I'm not sure about these two bits of code: . ' <param name="movie" value="http://tvloser.com/videos/$md5.flv">' PHP: . ' <param name="flashvars" value="config={videoFile:"http://tvloser.com/videos/$md5.flv",autoPlay: true}">' PHP:
Same deal. You just have to remove the variables from within the string, like this: . ' <param name="movie" value="http://tvloser.com/videos/' . $md5 . '.flv">' PHP: . ' <param name="flashvars" value="config={videoFile:"http://tvloser.com/videos/' . $md5 . '.flv",autoPlay: true}">' PHP:
Hi, Thanks very much - that works. However the following code is causing an issue: . ' <param name="flashvars" value="config={videoFile:"http://tvloser.com/videos/' . $md5 . '.flv",autoPlay: true}">' PHP: In order for the flash player to work the output must be in the format videoFile:'http://domain.com/file.flv' , with single quotes rather than double. I've attempted to correct this but can't quite get the syntax correct.
Single quotes have to be escaped with a backslash, between single quotes. Meaning: $string = 'videoFile:\'http://domain.com/file.flv\''; PHP: Makes sense? http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single
Hi, I tried the following and the SQL insert appears to fail as nothing is inserted. . ' <param name="flashvars" value="config={videoFile:\'http://tvloser.com/videos/' . $md5 . '.flv\',autoPlay: true}">' PHP: The php.net link isn't loading for me either.
I fixed the URL above. And let MySQL tell you what the issue is, by adding OR die(mysql_error()); at the end of the query. mysql_query("INSERT INTO [....]") OR die(mysql_error()); PHP:
Hi, OK, gives the error: 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 's Head Dents Wall','Kid's Head Dents Wall','<object type="application/x-shockwav' at line 1 Here's the current code for the SQL insert: 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="http://tvloser.com/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\')')OR die(mysql_error());; PHP:
nico_swd - For some reason your last post had dissapeared when I browsed back to it. From what I read when the post was visible you were saying that the values at the end of my query shouldn't be escaped. So the code is now as follows: 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="http://tvloser.com/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')')OR die(mysql_error());; PHP: This produces the following error: Parse error: syntax error, unexpected ''' in /home/tvloser/public_html/videos.php on line 296