Hya Guys.... the script below deletes a file from the server and then deletes its corresponding mySQL entry.
What im trying to do next is sort all the remaing SQL entires from lowest to highest (by track number) and then remnumber them so that there are no gaps:
//DELETE THE PHYSICAL FILE AND ITS DB ENTRY - renumber all tracks
$filename = $_POST['filename'];
$tracknum = $_POST['tracknum'];
$address = "../../audiofiles/$filename";
$select = "DELETE FROM tracks WHERE url = '$filename'";
$delete = mysql_query($select);
$whatsleft = "SELECT * FROM tracks ORDER BY tracknums ASC";
$run = MYSQL_QUERY($whatsleft);
$rows = MYSQL_NUM_ROWS($run);
$fixi = 1;
$update = "UPDATE tracks SET tracknums='$fixi'";
$doupdate = mysql_query($update);
echo ("File $filename - has been removed!");
At the moment all it does is set them to the total number of tracks that are in the db....can anyone help?