-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditVideosFunctions.inc.php
More file actions
27 lines (27 loc) · 1.45 KB
/
editVideosFunctions.inc.php
File metadata and controls
27 lines (27 loc) · 1.45 KB
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
<?php
function editVideos($conn, $newVideoName, $servicesTitle, $videoTitle, $videoDiscription, $videoStatus, $oldVideoFile, $videoId)
{
$query = "SELECT * FROM videos WHERE videoId='$videoId'";
$run = mysqli_query($conn, $query);
$row = mysqli_fetch_assoc($run);
$createDeletePath = "../../upload/" . $row['videoFile'];
if (mysqli_num_rows($run) > 0) {
if (unlink($createDeletePath)) {
$updateVideosQuery = "UPDATE videos SET videoTitle='$videoTitle', videoDiscription='$videoDiscription', videoFile='$newVideoName', servicesTitle='$servicesTitle', videoStatus='$videoStatus' WHERE videoId='$videoId'";
$run = mysqli_query($conn, $updateVideosQuery);
header("location: ../all-videos.php?error=none");
mysqli_close($conn);
}
}
}
function updateVideos($conn, $servicesTitle, $videoTitle, $videoDiscription, $videoStatus, $videoId)
{
$findCourse = "SELECT * FROM videos WHERE videoId = '$videoId'";
$result = mysqli_query($conn, $findCourse) or die("Query Unsuccessful.");
if (mysqli_num_rows($result) > 0) {
$updateVideosQuery = "UPDATE videos SET videoTitle='$videoTitle', videoDiscription='$videoDiscription', servicesTitle='$servicesTitle', videoStatus='$videoStatus' WHERE videoId='$videoId'";
$result = mysqli_query($conn, $updateVideosQuery);
header("location: ../all-videos.php?error=none");
mysqli_close($conn);
}
}