-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeleteAlbum.php
28 lines (26 loc) · 1.06 KB
/
deleteAlbum.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
session_start();
require ("functions.php");
checkLogin();
checkArtist();
$dbc = dbConn();
//check if the id is passed
if(isset($_REQUEST['id'])){
$albumId = $_REQUEST['id'];
delete('album_Id',$albumId, 'studios_albums', $dbc);
delete('album_Id',$albumId, 'comments', $dbc);
delete('album_Id',$albumId, 'rates', $dbc);
delete('album_Id',$albumId, 'artists_albums', $dbc);
mysqli_query($dbc, "DELETE asg FROM artists_songs asg
JOIN songs s ON asg.song_Id = s.song_Id
WHERE s.album_Id = $albumId");
mysqli_query($dbc, "DELETE ss FROM songs_songwriter ss
JOIN songs s ON ss.song_Id = s.song_Id
WHERE s.album_Id = $albumId");;
delete('album_Id',$albumId, 'songs', $dbc);
if($result = delete('album_Id',$albumId, 'albums', $dbc)){
mysqli_close($dbc);
redirect('http://localhost/Music%20Studio%20System/artistAlbum.php', 303);
}
}
?>