Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #9476

Re: Problem with quotes in javascript output

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: Problem with quotes in javascript output
Date 2013-05-20 12:53 -0400
Organization A noiseless patient Spider
Message-ID <kndk7h$got$1@dont-email.me> (permalink)
References <54lw0fd343qv$.gm5ydjjd60j9$.dlg@40tude.net>

Show all headers | View raw


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@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Problem with quotes in javascript output richard <noreply@example.com> - 2013-05-20 12:17 -0400
  Re: Problem with quotes in javascript output Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-20 12:53 -0400
  Re: Problem with quotes in javascript output richard <noreply@example.com> - 2013-05-20 14:12 -0400
  Re: Problem with quotes in javascript output Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-21 10:47 +0000
    Re: Problem with quotes in javascript output Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-21 13:59 +0200

csiph-web