-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreateNewPlaylistProcess.php
44 lines (27 loc) · 1.06 KB
/
createNewPlaylistProcess.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
42
43
44
<?php
session_start();
/******************************************************
*
* upload document from user
*
*******************************************************/
$result= "5";
$username=$_SESSION['username'];
$title= $_POST['title'];
$db_host = "mysql1.cs.clemson.edu";
$db_user = "MeTube_tahd";
$db_password = "metube4620";
$db_database = "MeTube_mtiz";
$conn = mysqli_connect($db_host, $db_user, $db_password, $db_database);
// $result = mysqli_query($conn, $query);
$playlistCheck = "SELECT * FROM playlists where title='$title'";
//Get USER_ID
$user_resquest = "SELECT user_id from users where username='$username';";
$user_response = mysqli_query($conn, $user_resquest);
$user_id = mysqli_fetch_assoc($user_response)["user_id"];
$insert = "INSERT INTO playlists( user_id, title, items_count ) VALUES( ".$user_id.", '".$title."', 0); ";
$queryresult = mysqli_query($conn, $insert);
$result = "0";
//You can process the error code of the $result here.
?>
<meta http-equiv="refresh" content="0;url=browse.php?result=<?php echo $result;?>">