jimmyslam Posted July 6, 2006 Share Posted July 6, 2006 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 More sharing options...
fenway Posted July 6, 2006 Share Posted July 6, 2006 Drop the "*"... should be "DELETE FROM...". Link to comment https://forums.phpfreaks.com/topic/13833-erasing-elements-with-sql-delete-where/#findComment-53957 Share on other sites More sharing options...
jimmyslam Posted July 10, 2006 Author Share Posted July 10, 2006 thanks it worked :) :D Link to comment https://forums.phpfreaks.com/topic/13833-erasing-elements-with-sql-delete-where/#findComment-55460 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.