Im new to JSON sintax and I need help to pass some results I've pulled via php from a database, to a JSON code. Here's the code:
<?php
$id_num = urldecode (intval($_REQUEST['id_cod']));
$rs = $lista->noticias_testa(1,$id_num);
$result = mysql_num_rows($rs);
$rs = $lista->noticiaAll($id_num);
$result = mysql_num_rows($rs);
$audio = "files/audios/".mysql_result($rs,0,"audio");
$title_audio = mysql_result($rs,0,"title_audio");
?>
And this JSON to fill a playlist for my mp3 player
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_1",
cssSelectorAncestor: "#jp_container_1"
}, [
{
title:"place to put php variable $title_audio",
mp3:"path to the music.mp3",
},
]);
});
//]]>
</script>
I want to pass the php variable "$audio" to the JSON "mp3 path" and title.
Thanks in advance