Problem with quotes in javascript output [message #181527] |
Mon, 20 May 2013 16:17 |
|
richard
Messages: 213 Registered: June 2013
Karma:
|
Senior Member |
|
|
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>
|
|
|