Link to home
Start Free TrialLog in
Avatar of Yong Scott
Yong ScottFlag for Malaysia

asked on

The record inside mysql not deleted

<?php
include 'config.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>File Uploading With PHP and MySql</title>

<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div id="header">
<label> Delete by date </label>
</div>
     <br /><br />
   <form action="index.php" method="post" enctype="multipart/form-data">
   <button type="submit" name="btn-main" style="height: 25px; width: 200px">MAIN PAGE</button>
    </form>
	     <br /><br />
<form>
<div id="body">
<input type="date" name="dd" placeholder="YY-MM-DD" required />
<input type="submit" name="delete" value="Submit"/>
</form>

<br/><br/>

</body>
</html>
<?php 

if(isset($_POST['delete']))
{

$date = $_POST['dd'];

  // mysql delete query 
    $query = "DELETE FROM nov WHERE date = $date";
    
         if(mysqli_query($db, $query)) {  
    
                       ?>
  <script>
  alert('successfully delete date');
        window.location.href='index.php?success';
        </script>
  <?php
    }else{
                       ?>
  <script>
  alert('failed delete date');
        window.location.href='index.php?success';
        </script>
  <?php
    }
    mysqli_close($db);
}

      
?>

Open in new window


The record not delete when i put date, anyone know any mistake over there , I tried change again and again still same .
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

it seems that your php scripts only delete the record in MySQL and regardless of what condition, it's not deleting the file (no delete file scripts found in the php scripts...)
Avatar of Yong Scott

ASKER

ya i edit the question first , i want to delete the record inside mysql hehe
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OMG its work .. I do the minor mistake then its failed LOL. Thanks for help