Jump to content

[SOLVED] What is wrong with this delete SQL?


papaface

Recommended Posts

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?

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);

 

$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.

Archived

This topic is now archived and is closed to further replies.

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