FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Problem with quotes in javascript output
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Problem with quotes in javascript output [message #181528 is a reply to message #181527] Mon, 20 May 2013 16:53 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 5/20/2013 12:17 PM, richard wrote:
> This is not a javascript question ok?
> First, the desired look of my endeavor is here.
> www.mroldies.net/test1.html
>
> What I am working on is here.
> www.mroldies.net/test2.php
>
> The problem mainly deals with required quotes in the javascript output.
> Either single or double.
>
> The code below shows you what I have been trying.
> The output code shows the text with the variable names, not the desired
> output.
>
> Do not run the code locally as the key will prevent it.
>
>
>
> <!DOCTYPE html>
> <html><head>
> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
> <script src="jwplayer/jwplayer.js"></script>
> <script>jwplayer.key="NIV";</script>
> </head>
>
> <body>
> <div id='my-video'></div>
> <script type='text/javascript'>
>
> jwplayer("my-video").setup({
> playlist: [{
> <?php
> /* connect to the db */
> $con = mysql_connect('localhost','user','pass');
>
>
> if (!$con){die("can not connect: " . mysql_error());}
>
> mysql_select_db('richbull_top100',$con);
>
> $year=1960;
> $number=1;
>
> $result = mysql_query("SELECT atitle,artist,avid FROM A$year WHERE id =
> $number");
> if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; }
> $vid = mysql_fetch_row($result);
>
>
> echo "{";
>
> echo 'file: "http://www.youtube.com/watch?v=$vid[2]"';
> echo ",";
> echo 'description: "$year # $number - $vid[1]"';
>
> echo "}";
>
>
>
>
>
> ?>
> ],
>
> "startparam":"start",
> "repeat":"list",
> "width":800,
> // adjust these 2 lines if you'd like to omit/resize playlist, etc:
> listbar:{position:'right',size:320},
> "height":450
>
> });
> </script>
>
> </body>
> </html>
>

There is no variable substitution in single quoted ('...') strings, only
double quoted ("...") strings.

You are using single quoted strings in your PHP code.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: comma placement problem
Next Topic: no date header in mail()
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 15:03:27 GMT 2024

Total time taken to generate the page: 0.06014 seconds