Jump to content

Playing Mp3 With Jw From Database


williamh26

Recommended Posts

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.