diff --git a/ci/application/config/config.php b/ci/application/config/config.php index 45c8d4f..3efe38d 100644 --- a/ci/application/config/config.php +++ b/ci/application/config/config.php @@ -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/'; /* |-------------------------------------------------------------------------- diff --git a/ci/application/controllers/Playlist.php b/ci/application/controllers/Playlist.php index 2d20ed9..ffd00a4 100644 --- a/ci/application/controllers/Playlist.php +++ b/ci/application/controllers/Playlist.php @@ -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'); } } \ No newline at end of file diff --git a/ci/application/models/Model_music.php b/ci/application/models/Model_music.php index 067789a..b53e150 100644 --- a/ci/application/models/Model_music.php +++ b/ci/application/models/Model_music.php @@ -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){ diff --git a/ci/application/views/playlist_list.php b/ci/application/views/playlist_list.php index 0e9fef7..41ec9ae 100644 --- a/ci/application/views/playlist_list.php +++ b/ci/application/views/playlist_list.php @@ -4,7 +4,7 @@ foreach($playlists as $playlist){ echo "
"; echo "
"; echo anchor("playlist/SongPlaylist/{$playlist->id}","{$playlist->name}"); - echo "
"; + echo ""; echo ""; echo "
"; echo "
";