-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathupdate.php
More file actions
37 lines (26 loc) · 901 Bytes
/
update.php
File metadata and controls
37 lines (26 loc) · 901 Bytes
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
<?php
include("db/db.php");
$title=$_POST['title'];
$description=$_POST['description'];
$video_id= $_POST["video_id"];
$update_details=mysql_query("update videos set title='$title', description='$description' where video_id=$video_id");
if(isset($_POST['category']))
{
foreach ($_POST['category'] as $selectedCategory)
{
$update_category=mysql_query("insert into vid_cat values(null,$video_id,$selectedCategory)");
}
}
if(isset($_POST['new_category']))
{
$insert_new=mysql_query("insert into categories value(null,'$_POST[new_category]')");
if(mysql_affected_rows()==1)
{
$category_id= mysql_insert_id();
$update_category=mysql_query("insert into vid_cat values(null,$video_id,$category_id)");
}
}
session_start();
$_SESSION["success"]=1;
header("location:manage.php");
?>