I am creating an delete function. However when I try to delete a row it deletes all my entry's.
if(@$_REQUEST['action']=="del")
{
mysql_query("DELETE FROM rythm WHERE rythm_Name=".round($_REQUEST['id2']));
}
this part is inside my HTML
echo "<td class=tabval><a onclick=\"return confirm
('are you sure?');\" href=index.php?action=del&id2=". $row['rythm_Name'].">
<span class=red>[test]</span></a></td>";
} ?>
Remove the round of in where
clause. Is there any reason to round of the $_REQUEST['id']
.
If $_REQUEST['id']
holds string value, You need surrounded with quotes.
Try this,
mysql_query("DELETE FROM rythm WHERE rythm_Name='".$_REQUEST['id2']."'");