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
https://forums.phpfreaks.com/topic/268670-playing-mp3-with-jw-from-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.