début création playlist

This commit is contained in:
Wilfried BRIGITTE 2024-06-03 18:44:18 +02:00
parent b5bb88c8da
commit 2461971a24
4 changed files with 38 additions and 1 deletions

View File

@ -33,4 +33,18 @@ class Playlist extends CI_Controller {
$delete = $this->model_music->deletePlaylist($playlist_id);
redirect('playlist');
}
}
public function MenuCreate() {
//$this->load->view('layout/header_album');
$this->load->view('create_playlist');
}
public function createPlaylistController() {
$name_playlist = $this->input->post('name_playlist');
$create = $this->model_music->createPlaylist($name_playlist);
redirect('playlist');
}
}

View File

@ -49,6 +49,14 @@ class Model_music extends CI_Model {
);
}
public function createPlaylist($name_playlist){
$name_playlist_escaped = $this->db->escape($name_playlist);
$query = $this->db->query(
"INSERT INTO playlist VALUES (1, $name_playlist_escaped);
"
);
}
public function getSongOfPlaylist($playlist_id){
$query = $this->db->query(
"SELECT SongPlaylist.name

View File

@ -0,0 +1,10 @@
<h5>Créer une nouvelle Playlist</h5>
<?php
?>
<form action="<?= base_url('index.php/playlist/createPlaylistController') ?>" method="post">
<label for="name_playlist">Nom de la Playlist:</label>
<input type="text" name="name_playlist" id="name_playlist" required>
<button type="submit" name="submit">Créer</button>
</form>

View File

@ -1,5 +1,10 @@
<h5>Playlist List</h5>
<?php
echo "<form action='" . base_url("index.php/playlist/MenuCreate/") . "' method='post'>";
echo "<button type='Créer Playlist'>Create</button>";
echo "</form>";
foreach($playlists as $playlist){
echo "<div><article>";
echo "<header class='short-text'>";