AngN Posted September 13, 2007 Share Posted September 13, 2007 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 Quote Link to comment Share on other sites More sharing options...
recklessgeneral Posted September 13, 2007 Share Posted September 13, 2007 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.