I am trying to receive text input and store it as a variable. Then I use PDO to execute a query that deletes a row from a MySQL database that contains text that matches the text stored in the variable. Obviously this is not working. My usual suspect is my query. I have also been toying with binding params but that didn't work either.
<?php
if (isset($_POST['gigDate'])){
$gigDate = $_POST['gigDate'];
if (!empty($gigDate)){
require_once("dbconnect.php");
$query = $connect->prepare("DELETE * FROM 'gigs' WHERE 'date'='".$gigDate."'");
$query->execute();
}
else
{
echo "failure";
}
require_once('gui.php');
}
?>
This is my html form
<h3>Delete a gig by date. (copy and paste gig date)</h3>
<?php include ("gigDelete.php");?>
<form action="gigDelete.php" method="post">
<input type="text" name="gigDate"></input>
<button type="submit" value="Delete" name="Delete">delete gig</button>
</form>
I have had one error message that stated that my error reporting wasn't working. haha. So I removed it. I only just learned PDO last week and I am unsure if it is appropriate for this task.. How my inexperience shines!
This is the last part of my first ever php GUI. I can upload to the database just dandy and I am displaying the data in a html table which is also working. So I can assume I'm connecting to the db.