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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.