Jump to content

Erasing elements with SQL DELETE WHERE


jimmyslam

Recommended Posts

Im triying to erase a row with this code.

[code] $id=$_GET['id'];
echo "#".$id." ";
$temp = intval($id);

$sql="DELETE * FROM news WHERE ID = $temp";
mysql_query ($sql);
[/code]

Why is not erasing? the ID table nad everything exists i dont get any error mensage either.

If I edit it works with this:
[code]$ID=$_GET['ID'];
$date=$_POST['Year']."-".$_POST['Month']."-".$_POST['Day'];
$description=$_POST['text'];
$linkN=$_POST['linkN'];
$linkURL=$_POST['linkURL'];

$sql = "UPDATE news SET date = '$date', description = '$description', linkN = '$linkN', linkURL = '$linkURL' WHERE ID = '$ID'";

mysql_query ($sql);
echo("UPDATED!!!");[/code]


If i try like this:
[code] $id=$_GET['id'];
echo "#".$id." ";
$temp = intval($id);

$sql="DELETE * FROM news WHERE ID = '$id'";
mysql_query ($sql);


echo ("ERASED");[/code]
it doesnt work either.

:-S :-\
Link to comment
https://forums.phpfreaks.com/topic/13833-erasing-elements-with-sql-delete-where/
Share on other sites

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.