Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if($user == $me){
- $sql_delete = "DELETE FROM replys WHERE id = '$id' AND rusername = '$me'";
- echo $sql_delete;
- mysql_query($sql_delete) or die(mysql_error());
- echo "Deleted";
- }
- else{
- }
- }
- ?>
- <?php
- session_start();
- if(isset($_POST['DeleteThis'])){
- $db_host = "localhost";
- $db_user = "root";
- $db_pass = "kindom";
- $db_name = "posters";
- try {
- $user = $_SESSION['username'];
- $form = $_POST;
- $id = $form['id']);
- $me = $form['me'];
- if($me == $user){
- $db_conn = new PDO("mysql:host={$db_host};dbname={$db_name}",$db_user,$db_pass);
- $db_conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $stmt = $db_conn->prepare("DELETE FROM replys WHERE id = :id AND rusername = :user");
- //I have tried using this SQL statements
- //$query = "DELETE FROM replys WHERE id = {$id} AND rusername = {$user}";
- //$query = "DELETE * FROM replys WHERE id = :id AND rusername = :rusername";
- $query = "DELETE FROM replys WHERE id = :id AND rusername = :rusername";
- $stmt->bindParam(':id', $id);
- $stmt->bindParam(':rusername', $user);
- $stmt->execute();
- echo "Deleted";
- }
- else{
- //Do nothing
- }
- }
- catch(PDOException $e)
- {
- echo "Error:" . $e->getMessage();
- }
- $db_conn = null;
- }
- ?>
- <a href="javascript:void(0);" onclick="document.getElementById('deleterp').submit();"><i style="font-size:17px;color:#F00;" class="fa fa-trash"></i></a>
- <form id="deleterp" action="" method="POST">
- <input type="hidden" name="id" value="<?php echo $rpId;?>"/>
- <input type="hidden" name="DeleteThis" value="1"/>
- <input type="hidden" name="me" value="<?php echo $rplyuser;?>"/>
- </form></div>
- $stmt = $db_conn->prepare("DELETE FROM replys WHERE id = :id AND rusername = :rusername");
- $stmt = $db_conn->prepare("DELETE FROM replys WHERE id = :id AND rusername = :user");
- <?php
- .
- .
- $stmt = $db_conn->prepare("DELETE FROM replys WHERE id = :id AND rusername = :rusername");
- $stmt->bindParam(':id', $id);
- $stmt->bindParam(':rusername', $user);
- .
- .
- ?>
- $id = $form['id']);
- $id = $form['id'];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement