php - How to delete a picture after i searched it in database? -


as administrator want delete pictures website after have searched picture. doesn't delete file ($target).

<nav>     <a href="../home/frontend.php"><img class="icon" src="../logo/home.png" /></a>     <a href="../search/search.php"><img class="icon" src="../logo/search.png" /></a>     <a href="../upload/upload.php"><img class="icon" src="../logo/camera.png" /></a>     <a href="../super/supervisor.php"><img class="icon" src="../logo/supervisor.png" /></a>     <a href="../profile/profile.php"><img class="icon" src="../logo/profile.png" /></a> </nav>  <div class="searchdiv">     <form action="supervisor.php" method="post">         <input type="text" class="search" name="search" placeholder="zoek een foto..." autocomplete="off">         <br>         <input type="submit" name="submit" id="submitupload" value="zoeken">     </form> </div>  <?php if(isset($_post['submit'])) { $dbc = mysqli_connect('localhost', '22894_opdracht1', '22894_opdracht1', '22894_database') or die ('error connecting!'); $search = $_post['search']; $query = "select * instaclone description '%" . $search . "%' or username '%" . $search . "%' or date '%" . $search . "%'"; $result = mysqli_query($dbc, $query); while ($row = mysqli_fetch_array($result)){     $target = $row['target'];     $date = $row['date'];     $username = $row['username'];     $description = $row['description'];     echo '<div class="picture">';     echo '<div class="name">';     echo '<div class="date">';     echo $username . '<br>';     echo $date;     echo '</div>';     echo '</div>';     echo '<img class="pictureshow" src="' . $target . '" /><br>';     echo '<p class="beschrijving">' . '<b>' . $username  . ': </b>' . $description;     echo '<div class="reactions">';     echo '<form method="post">';     echo '<input type="text" name="reaction" class="reaction" placeholder="een reactie toevoegen...">';     echo '</form>';     echo '</div>';     echo '</div>';          if(isset($_post['delete'])) {             $sql = "delete instaclone target  '%" . $target . "%' ";         }     } mysqli_close($dbc); } ?>  <div class="deletediv">     <form action="supervisor.php" method="post">         <input type="submit" name="delete" id="submitupload" value="delete">     </form> </div> 

i want delete $target after delete sumbit button pressed.

 if(isset($_post['delete'])) {         $sql = "delete instaclone target = '$target' ";         mysqli_query($dbc, $sql);         echo "$target deleted";      } 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -