-
Notifications
You must be signed in to change notification settings - Fork 1
/
viewgallery.php
100 lines (94 loc) · 2.63 KB
/
viewgallery.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
include("header.php");
include("connection.php");
?>
<script type="text/JavaScript">
function confirmDelete(){
var agree=confirm("Are you sure you want to delete this Album?");
if (agree)
return true;
else
return false ;
}
</script>
<?php
if(isset($_GET["albid"]))
{
mysqli_query($con,"Delete from gallery where album_id='$_GET[albid]'");
if(mysqli_affected_rows($con) == 1)
{
$succrec = 1;
}
}
if($_POST["button"])
{
$result = mysqli_query($con,"SELECT * FROM gallery WHERE album_name LIKE '%$_POST[name]%'");
}
else
{
$result = mysqli_query($con,"SELECT * FROM gallery");
}
?>
<div id="main">
<div id="content" class="left">
<div class="highlight">
<h3>View Gallery</h3>
<form id="form1" name="form1" method="post" action="">
<p><a href="gallery.php"><strong>Add New Gallery </strong></a>
<label for="name"></label>
<input type="text" name="name" id="name" />
<input type="submit" name="button" id="button" value="Search" />
</p>
</form>
<table width="577" border="1">
<tr>
<th height="29" colspan="4" scope="col">
<?php
if($succrec == 1)
{
echo "Album deleted successfully....";
}
?>
</th>
</tr>
<tr>
<th width="103" height="51" scope="col">SL NO</th>
<th width="259" scope="col">Album Name</th>
<th width="91" scope="col">Total No. of images</th>
<th width="96" scope="col">Delete</th>
</tr>
<?php
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td> $row[album_id]</td>";
echo "<td> <a href='viewphotos.php?albumid=$row[album_id]'>$row[album_name]</a></td>";
$resultx = mysqli_query($con,"SELECT * FROM upload_data where album_id='$row[album_id]'");
$imgcnt = mysqli_num_rows($resultx);
echo "<td> $imgcnt</td>";
echo "<td> <a href='viewgallery.php?albid=$row[album_id]' onClick='return confirmDelete();'> Delete Album </a></td>";
echo "</tr>";
}
?>
</table>
<p> </p>
</div>
<div class="projects">
<div class="item"></div>
<div class="item">
<div class="cl"> </div>
</div>
</div>
</div>
<?php
include("sidebar.php");
?>
<div class="cl"> </div>
</div>
<div class="shadow-l"></div>
<div class="shadow-r"></div>
<div class="shadow-b"></div>
</div>
<?php
include("footer.php");
?>