suppresion playlist fin

This commit is contained in:
Wilfried BRIGITTE 2024-06-03 17:52:42 +02:00
parent 15a1c8f6a6
commit b5bb88c8da
4 changed files with 14 additions and 13 deletions

View File

@ -23,7 +23,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = '/~gallego/SAEWEB2.2/ci/';
$config['base_url'] = '/~brigitte/SAEWEB2.2/ci/';
/*
|--------------------------------------------------------------------------

View File

@ -22,16 +22,15 @@ class Playlist extends CI_Controller {
//$this->load->view('layout/footer_album');
}
public function SongPLaylist($playlist_id){
public function SongPlaylist($playlist_id){
$songPlaylists = $this->model_music->getSongOfPlaylist($playlist_id);
//$this->load->view('layout/header_album');
$this->load->view('song_playlist', ['songPlaylists' => $songPlaylists]);
//$this->load->view('layout/footer_album');
}
public function deletePlaylist($playlist_id) {
$playlists = $this->model_music->deletePlaylist($playlist_id);
/*$this->load->view('playlist_list', ['playlists' => $playlists]);*/
redirect('playlist/index');
public function delete($playlist_id) {
$delete = $this->model_music->deletePlaylist($playlist_id);
redirect('playlist');
}
}

View File

@ -39,12 +39,14 @@ class Model_music extends CI_Model {
}
public function deletePlaylist($playlist_id){
$query = $this->db->query(
"DELETE FROM SongPlaylist
WHERE id = $playlist_id
"
);
return $query->result();
$this->db->query(
"DELETE FROM SongPlaylist WHERE id = ?", array($playlist_id)
);
// Ensuite, supprimer l'enregistrement dans playlist
$this->db->query(
"DELETE FROM playlist WHERE id = ?", array($playlist_id)
);
}
public function getSongOfPlaylist($playlist_id){

View File

@ -4,7 +4,7 @@ foreach($playlists as $playlist){
echo "<div><article>";
echo "<header class='short-text'>";
echo anchor("playlist/SongPlaylist/{$playlist->id}","{$playlist->name}");
echo "<form action='" . base_url("index.php/playlist/deletePlaylist/{$playlist->id}") . "' method='post'>";
echo "<form action='" . base_url("index.php/playlist/delete/{$playlist->id}") . "' method='post'>";
echo "<button type='Supprimer Playlist'>Delete</button>";
echo "</form>";
echo "</header>";