Q:

Entire database deletes instead of one row

I have been trying to delete a row in my mySQL database on the onclick of a delete button. But instead of the one mySQL row getting deleted, all rows in the database get deleted. 
I am targeting just the specific ID, so I am unclear as to why all other ID's are getting deleted.
HTML:
<?php foreach ($movies as $movie) : ?>
    <div class="col-4">
        <div class="card card-cascade">
            <div class="view gradient-card-header purple-gradient">
                <h2><?php echo $movie['name']; ?></h2>
                <p><?php echo $movie['genre']; ?></p>
            </div>
            <div class="card-body text-center">

                    <!-- Delete -->
                    <a type="button" class="btn-floating btn-small btn-dribbble delbutton" data-toggle="tooltip" data-placement="top" title="Delete" id="<?php echo $movie['id']; ?>"><i class="fa fa-trash-o" aria-hidden="true"></i></a>

            </div>
        </div>
    </div>
    <?php endforeach; ?>

JS:
$(function () {
  // Tooltips Initialization
  $('[data-toggle="tooltip"]').tooltip();

  // Delete Movie
  $(".delbutton").click(function() {
        console.log('watch me')
        var del_id = $(this).attr("id");
        var info = 'id=' + del_id;
        if (confirm("Sure you want to delete this post? This cannot be undone later.")) {
            $.ajax({
                type : "POST",
                url : "../movieApp/delete.php", //URL to the delete php script
                data : {id:info},
                success : function() {
                    console.log("success");
                    },
                error: function () {
                    console.log("failed");
                },
                });
            $(this).parents(".record").animate("fast").animate({
                opacity : "hide"
            }, "slow");
        }
        return false;
    });
});

PHP:

require 'config/config.php';
require 'config/db.php';

if($_POST['id']){
    $id=$_POST['id'];

    $delete = "DELETE FROM movies WHERE id=$id";
    $result = $conn->query($delete);
}

if (mysqli_query($conn, $sql)) {
mysqli_free_result($result);
mysqli_close($conn);
echo "Worked!";
exit;
} else {
    echo "Error deleting record";
}

A:

You set ajax method POST, But Post data format is not correct as per your requirement.

Change your ajax Data like as

 //var info = 'id=' + del_id;
 var info = {
   id : del_id
 }

And 

$.ajax({
  /*...*/
  data : info,
  /*.../
});

And also check if your id field is string, If integer then change the Query string to -

#$delete = "DELETE FROM movies WHERE id='$id'";
$delete = "DELETE FROM movies WHERE id=$id";

Also change - 

#$_POST['info']
$_POST['id']

Because, You didn't set $_POST['info'] anywhere in your code.
Note : And don't forget to console your correct Ajax URL

