williamh26 Posted September 22, 2012 Share Posted September 22, 2012 Hi guys i would like to play a mp3 files from my dadabase using jw. this is my table [b]table: audio player[/b] genero_id int(10) AUTO_INCREMENT name varchar(255) [b]table: canciones[/b] cancion_id int(10) AUTO_INCREMENT genero_id int(10) autor varchar(255) titulo_cancion varchar(255) audio varchar(255) I polulate each genre with the following code: <?php mysql_connect("localhost", "audioplayer", "audioplayer") or die(mysql_error()); mysql_select_db("audioplayer") or die(mysql_error()); $limit=3; $count=0; echo"<table border='0' align='center' cellpadding='2' cellspacing='2' width='100%'>"; $query="SELECT genero_id, name from audioplayer"; $result=mysql_query($query); while($row=mysql_fetch_array($result,MYSQL_ASSOC)) { $genero_id = $row['genero_id']; $name = $row['name']; if ($count < $limit) { if($count ==0) { echo"<tr>"; } echo"<td align='center' VALIGN='TOP'><font size='1.2' face='Verdana'><a href=\"index.php?content=cancion&cat=$genero_id\">$name</a></font><br><br></td>"; }else { // $count=0; // echo"</tr><tr VALIGN='TOP'><td align='center'><font size='1.2' face='Verdana'><a href=\"index.php?content=cancion&cat=$genero_id\">$name</a></font><br></td>"; } $count++; } echo"</tr></table>"; ?> Then i would like to get the audio player songs contain in each with this code <HTML> <HEAD> <TITLE>New Document</TITLE> <script type="text/javascript" src="js/audio-player.js"></script> <script type="text/javascript"> AudioPlayer.setup("http://localhost/audioplayer/js/player.swf", { width: 290 }); </script> </HEAD> <BODY> <?php $genero_id = $_GET['cat']; $query = "Select count(cancion_id) from canciones where genero_id = $genero_id"; $result = mysql_query($query); $row = mysql_fetch_array($result); if ($row[0] == 0) { echo "<h2 align='center'><br>Lo Sentimos no hay canciones en este momento</h2>\n"; } else { $sql = mysql_query("SELECT * from canciones WHERE genero_id=$genero_id"); //variable $limit=1; $count=0; echo"<table class='pretty-table' border='0' align='center' cellpadding='2' cellspacing='2' width='90%'>"; while($row = mysql_fetch_array($sql)){ $genero_id = $row['genero_id']; $autor = $row['autor']; $titulo_cancion = $row['titulo_cancion']; $audio = $row['audio']; if ($count < $limit) { if($count ==0) { echo"<tr>"; } //<img src='images/index_27.gif' width='16' height='17' alt='' /> echo"<p id='audioplayer_$cancion_id'>$titulo_cancion</p>"; echo"<script type='text/javascript'>"; AudioPlayer.embed('audioplayer_$cancion_id', {soundFile: 'http://localhost/audioplayer/canciones/$audio.mp3'}); echo"</script>"; echo"<br>"; }else { // $count=0; // echo"<p id='audioplayer_$cancion_id'>$titulo_cancion</p>"; echo"<script type='text/javascript'>"; AudioPlayer.embed('audioplayer_$cancion_id', {soundFile: 'http://localhost/audioplayer/canciones/$audio.mp3'}); echo"</script>"; echo"<br>"; } $count++; } echo"</tr></table>"; } ?> </BODY> </HTML> But i have this error... can help me please Parse error: syntax error, unexpected '{' in C:\wamp\www\audioplayer\cancion.inc.php on line 53 Call Stack # Time Memory Function Location 1 0.0006 367848 {main}( ) ..\index.php:0 Thank you very much in advanced Quote Link to comment Share on other sites More sharing options...
JLT Posted September 22, 2012 Share Posted September 22, 2012 I can tell you on your 2nd snippet of code, you have one less } than you should have. You are closing off your IF statements, but your WHILE is left open. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 22, 2012 Share Posted September 22, 2012 Properly indenting your code would make it more obvious. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.