-
Notifications
You must be signed in to change notification settings - Fork 0
/
process_edit_musicas.php
41 lines (28 loc) · 1.16 KB
/
process_edit_musicas.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
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
session_start();
require_once ('MysqliDb.php');
$db = new MysqliDb ('localhost', 'root', '', 'perfectmatch');
$msg = "";
if (isset($_POST['upload'])) {
$artista = $_POST["artistas"];
$nomemusica = $_POST["nomemusicas"];
$genero = $_POST["generos"];
$db -> where("id_login", $_SESSION['id_login']);
$perfil_logado = $db -> get("perfis");
$db -> where("id_perfil", $perfil_logado[0]["id_perfil"]);
$db -> delete("musica");
for ($i = 0; $i < count($artista); $i++){
if (strlen((string)$artista[$i])!==0 && strlen((string)$nomemusica[$i])!==0){
$data = Array (
'artista' => $artista[$i],
'nome_musica' => $nomemusica[$i],
'genero' => $genero[$i],
'id_perfil' => $perfil_logado[0]["id_perfil"]
);
$db -> insert("musica", $data);
}
}
header("Location: mainPage.php");
}
header("Location: mainPage.php");
?>