Jump to content

Delete not working


AngN

Recommended Posts

Hi,

 

Can anyone see why this is not deleting the record from the database?  I'm particularly unsure about the bolded lines.

 

if (isset($deletePosition))

{

$sql = "DELETE from POSITIONS

WHERE job_id=$deletePosition";

if (@mysql_query($sql))

{

echo("<p>The position has been deleted.</p>");

}

else

{

echo ("<p>Error deleting position.".

mysql_error() . "<p>");

}

}

 

And here is the file that calls it

 

// Fetch each database table row of the results

while($row = @ mysql_fetch_array($result))

 

{

echo ("<p>" . $row["job_id"]  ).

(  $row["title"]  ).

(  $row["employer"] ) .

(  $row["start_date"]  ).

(  $row["salary"]  ) .

(  $row["req_exp"]  ) .

(  $row["req_skills"]  ) .

(  $row["description"]  ) .

(  $row["remove"]  );

}

?>

<a href="remove.php">

Remove</a>

</html>

 

 

Thank you

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/69136-delete-not-working/
Share on other sites

Hi,

 

Is $deletePosition actually set? If so, what is it set to, and is there a matching job_id in your database? The easiest way to debug these things is to echo the sql statement that you are executing to see what the database gets.

 

A related question is how is $deletePosition getting its value? The usual way of passing this info through is via the url on the calling page and then getting its value from $_GET[].

 

Cheers,

Darren.

Link to comment
https://forums.phpfreaks.com/topic/69136-delete-not-working/#findComment-347580
Share on other sites

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.