ryeman98 Posted June 21, 2007 Share Posted June 21, 2007 Hi there, I hope you're having a good day Whenever I click the submit image, that is supposed to delete it, but it doesn't. delete it from the database. Here's the code: Main page <?php <form action=\"http://php.sunnyneo.com/DeleteProject.php\" method=\"post\"><input type=\"hidden\" name=\"id\" value\"".$row['id']."\"><input type=\"image\" src=\"http://php.sunnyneo.com/images/cancel_f2.png\" alt=\"Delete\"></form> ?> Delete page <?php $id = $_POST['id']; $delete = mysql_query("DELETE FROM `projects` WHERE id='$id'") or die(mysql_error()); header('Location: http://somesite.com/project.php'); ?> Link to comment https://forums.phpfreaks.com/topic/56596-wont-delete-from-database/ Share on other sites More sharing options...
virtuexru Posted June 21, 2007 Share Posted June 21, 2007 First off, do just: <?php $bla = mysql_query("DELETE FROM projects WHERE id = '$id'") ?> But you should probably do this instead for this first page: <?php <a href="http://php.sunnyneo.com/DeleteProject.php?id=".$row['id']."" /><img src="" border="0" /></a> //then use the $_GET['id'] method.. ?> Link to comment https://forums.phpfreaks.com/topic/56596-wont-delete-from-database/#findComment-279522 Share on other sites More sharing options...
ryeman98 Posted June 21, 2007 Author Share Posted June 21, 2007 Still won't delete and I changed a few pages: <?php require($_ENV['SITE_HTMLROOT']."/include/dbconnect_class.php"); $db = new DB; $id = $_POST['id']; $delete = mysql_query("DELETE FROM `projects` WHERE id = '$id'"); header('Location: http://somesite.com/project.php'); ?> Link to comment https://forums.phpfreaks.com/topic/56596-wont-delete-from-database/#findComment-279533 Share on other sites More sharing options...
ryeman98 Posted June 21, 2007 Author Share Posted June 21, 2007 Bumping this because I am doing this for another site. Link to comment https://forums.phpfreaks.com/topic/56596-wont-delete-from-database/#findComment-279549 Share on other sites More sharing options...
ryeman98 Posted June 21, 2007 Author Share Posted June 21, 2007 I'm sorry I have to double bump but I don't know why it isn't working... there aren't any errors or anything. Link to comment https://forums.phpfreaks.com/topic/56596-wont-delete-from-database/#findComment-279573 Share on other sites More sharing options...
trecool999 Posted June 21, 2007 Share Posted June 21, 2007 Still won't delete and I changed a few pages: $delete = mysql_query("DELETE FROM `projects` WHERE id = '$id'") or die('ERROR: ' . mysql_error()); Well there aren't going to be errors unless you request them... Link to comment https://forums.phpfreaks.com/topic/56596-wont-delete-from-database/#findComment-279575 Share on other sites More sharing options...
ryeman98 Posted June 21, 2007 Author Share Posted June 21, 2007 I did before but there still isn't any. Link to comment https://forums.phpfreaks.com/topic/56596-wont-delete-from-database/#findComment-279586 Share on other sites More sharing options...
suma237 Posted June 22, 2007 Share Posted June 22, 2007 Please print the query and check if is the query is executing or not ? Link to comment https://forums.phpfreaks.com/topic/56596-wont-delete-from-database/#findComment-279986 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.