ryeman98 Posted June 22, 2007 Share Posted June 22, 2007 I just don't get it... the connection is fine and the page doesn't show any errors at all so I have no idea what's wrong. Please help. <?php require($_ENV['SITE_HTMLROOT']."/include/dbconnect_class.php"); $db = new DB; ?> <?php $id = $_POST['id']; mysql_query("DELETE FROM projects WHERE id='$id'") or die(mysql_error()); echo "You have deleted the project from the list. <a href=\"/project.php\">Back?</a>"; ?> Link to comment https://forums.phpfreaks.com/topic/56775-solved-still-wont-delete-from-database/ Share on other sites More sharing options...
pocobueno1388 Posted June 22, 2007 Share Posted June 22, 2007 It looks fine to me.... Maybe double check that your form field that you enter the ID in is really named "id". Try echoing your query out and see if the $id turns out blank. <?php require($_ENV['SITE_HTMLROOT']."/include/dbconnect_class.php"); $db = new DB; ?> <?php $id = $_POST['id']; echo "DELETE FROM projects WHERE id='$id'"; //echo "You have deleted the project from the list. <a href=\"/project.php\">Back?</a>"; ?> Link to comment https://forums.phpfreaks.com/topic/56775-solved-still-wont-delete-from-database/#findComment-280405 Share on other sites More sharing options...
ryeman98 Posted June 22, 2007 Author Share Posted June 22, 2007 <input type=\"hidden\" name=\"id\" value\"".$row['id']."\"> <input type=\"image\"src=\"http://php.sunnyneo.com/images/cancel_f2.png\" alt=\"Delete\"> I just don't get it... :-\ Link to comment https://forums.phpfreaks.com/topic/56775-solved-still-wont-delete-from-database/#findComment-280406 Share on other sites More sharing options...
pocobueno1388 Posted June 22, 2007 Share Posted June 22, 2007 What did it echo out with the code I gave you above after you submitted the form? Link to comment https://forums.phpfreaks.com/topic/56775-solved-still-wont-delete-from-database/#findComment-280413 Share on other sites More sharing options...
ryeman98 Posted June 22, 2007 Author Share Posted June 22, 2007 1You have deleted the project from the list. Back? I noticed the 1 but I don't know what that means. Link to comment https://forums.phpfreaks.com/topic/56775-solved-still-wont-delete-from-database/#findComment-280415 Share on other sites More sharing options...
pocobueno1388 Posted June 22, 2007 Share Posted June 22, 2007 Just put this and see what it returns: <?php require($_ENV['SITE_HTMLROOT']."/include/dbconnect_class.php"); $db = new DB; ?> <?php $id = $_POST['id']; echo $id; ?> The only thing I can think of is that for some reason your ID field is not going through...so if that doesn't echo anything...then thats the problem. Link to comment https://forums.phpfreaks.com/topic/56775-solved-still-wont-delete-from-database/#findComment-280422 Share on other sites More sharing options...
ryeman98 Posted June 22, 2007 Author Share Posted June 22, 2007 Nothing appears... It's just a blank page. :-\ Link to comment https://forums.phpfreaks.com/topic/56775-solved-still-wont-delete-from-database/#findComment-280423 Share on other sites More sharing options...
pocobueno1388 Posted June 22, 2007 Share Posted June 22, 2007 okay...lets try this. Change this: <input type=\"hidden\" name=\"id\" value\"".$row['id']."\"> To this: <?php echo '<input type="hidden" name="id" value = "'.$row['id'].'">'; ?> Are you positive that $row['id'] holds a value? Link to comment https://forums.phpfreaks.com/topic/56775-solved-still-wont-delete-from-database/#findComment-280430 Share on other sites More sharing options...
marcus Posted June 22, 2007 Share Posted June 22, 2007 When you're defining the value for the ID, you don't have an equal sign to it's just emitting valueNUMBER Link to comment https://forums.phpfreaks.com/topic/56775-solved-still-wont-delete-from-database/#findComment-280434 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.