papaface Posted February 24, 2007 Share Posted February 24, 2007 Hello, I have been staring at this code for about 20 minutes now and I cant figure out why it isnt working: $edit_this_word_id = $_SESSION['word_edit_id']; if (isset($_POST['delete'])) { require("../includes/connect.php"); require("../includes/selectdb.php"); $delete_word = mysql_query("delete filter_id from filter where filter_id='{$edit_this_word_id}'"); $_SESSION['word_edit_id'] is set. Any ideas? Link to comment https://forums.phpfreaks.com/topic/39971-solved-what-is-wrong-with-this-delete-sql/ Share on other sites More sharing options...
emehrkay Posted February 24, 2007 Share Posted February 24, 2007 delte is used to remove rows. if you just want to change the filter_id to '' then run an update "UPDATE filter SET filter_id = '' WHERE filter_id = ". $edit_this_word_id and i would spilt the process up like this $query = "UPDATE..."; $result = mysql_query($query) or die(mysql_error()."<br />".$query); Link to comment https://forums.phpfreaks.com/topic/39971-solved-what-is-wrong-with-this-delete-sql/#findComment-193273 Share on other sites More sharing options...
papaface Posted February 24, 2007 Author Share Posted February 24, 2007 No I want to delete it. Link to comment https://forums.phpfreaks.com/topic/39971-solved-what-is-wrong-with-this-delete-sql/#findComment-193274 Share on other sites More sharing options...
magic2goodil Posted February 24, 2007 Share Posted February 24, 2007 $delete_word = mysql_query("delete from filter where filter_id='$edit_this_word_id'"); try that..although that will delete the whole row... you may try an update to set the value of filter_id to NULL or soemthing instead if you just want to edit that column. Link to comment https://forums.phpfreaks.com/topic/39971-solved-what-is-wrong-with-this-delete-sql/#findComment-193275 Share on other sites More sharing options...
papaface Posted February 24, 2007 Author Share Posted February 24, 2007 $delete_word = mysql_query("delete from filter where filter_id='$edit_this_word_id'"); Yes that works thanks Link to comment https://forums.phpfreaks.com/topic/39971-solved-what-is-wrong-with-this-delete-sql/#findComment-193276 Share on other sites More sharing options...
magic2goodil Posted February 24, 2007 Share Posted February 24, 2007 Link to comment https://forums.phpfreaks.com/topic/39971-solved-what-is-wrong-with-this-delete-sql/#findComment-193277 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.