Jump to content

deleting specific rows from database with $_POST()


Digitry Designs

Recommended Posts

Ok,

    here is what i have. I am trying to use a form where user types out the name of something in the row. upon submit the row is deleted. User is not editing php so hardcoding wont work. I am able to delete all rows, but I want to delete just what was input into the form. Here is what i have

 

<?php
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("time_sheets", $con);

    $sql = "DELETE FROM jobs
VALUES
('$_POST[jobs],$_POST[jobID]') ";
    echo "Row deleted!";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "Jobs updated";

mysql_close($con)

?> 
<html>
<head>
...You are being redirected to the jobs update form.
<meta http-equiv="refresh" content="1;url=list.php">
</head>
<title>Jobs updated</title>
</html>

 

Any help is very apreciated! Thank you in advance!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.