OK.... NEWBIE HERE!!!
I'm trying to put together a page where streaming audio file name is hidden. The URL is in a MYSQL database. Plus, i'm trying to count and display how many listens the audio file has on the same page.
i'm trying to so something similar to http://www.hiphopgame.com/index2.php3?page=tracks
the mysql database for the table "downloads" looks like....
dl_id | dl_url | dl_listens
I found a few scripts on this board that could help me do this, but i'm having trouble piecing them together.
HIding the URL: http://www.phpbuilder.com/board/showthread.php?threadid=10235863&highlight=audio
Counter: http://www.phpbuilder.com/board/showthread.php?threadid=10227398&highlight=download+counter
This is what I have for my PHP file... please any suggestion, tips, or anything to help me out!!! And how to I replicate it for a multiple listing of audio files on the page... thanx in advance....
<?
session_start();
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
/* Doing the relevant stuff */
$link = mysql_connect("localhost", "username", "password")
or die("Could not connect");
mysql_select_db("database") or die("Could not select database");
$query = "SELECT * FROM downloads WHERE dl_id = '$dl_id";
$result = mysql_query($query) or die("Query failed");
$foo=mysql_fetch_array($result);
$product=$foo['downloads_dl_url'];
mysql_close($link);
?>
<?
header("Location: " . $product);
?>
<?
//adds download to database
$conn = mysql_connect("localhost", "username", "password");
mysql_select_db("database");
$query = "SELECT dl_listens FROM downloads";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_object($result);
$dl_listens = $row->dl_listens;
$dl_listens = $dl_listens + "1";
$query = "UPDATE downloads SET dl_listens = '$dl_listens' WHERE dl_id = '1'";
mysql_query($query);
mysql_close($conn);
?>
<table width="450" border="0" cellspacing="1" cellpadding="0">
<tr>
<td><a href="audio.php?dl_id=1" target="_self">EGO</a></td>
<td><?
$conn = mysql_connect("localhost", "username", "password");
mysql_select_db("database");
$query = "select * from downloads";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_object($result);
$dl_listens = $row->dl_listens;
echo "Downloads of something: ".$dl_listens;
mysql_close($conn);
?>
</td>
</tr>
</table>
</body>
</html>