Re: How do I delete a composite key?
| From: | Stut | Date: | Sun, 26 Aug 2007 19:05:13 +0000 |
| Subject: | Re: How do I delete a composite key? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-261300@lists.php.net to get a copy of this message | ||
nitrox . wrote:
Im trying to delete a composite key but cannot figure out the proper format. Would somebody tell me where im messing up? I have an url that is supposed to send the member id and game id to a delete query. And the delete query is supposed to grab the id's based on type. This is the link: <a href=\"member_commit.php?action=remove&type=Member&id={$record->Member_id}&gametype=Game&id={$record->Game_id}\">[GAME REMOVAL]</a></td>\n"; <snip>
$sql = "DELETE
FROM xsm_membergames
WHERE Member_id = '" . mysql_real_escape_string((int)$_GET['id']) . " .
AND Game_id = '" . mysql_real_escape_string((int)$_GET['id']) . "'";
Your URL contains 2 instances of a GET variable named, which you then use in the SQL query. In this instance $_GET['id'] will contain just the Game_id. Change the name of one or both IDs and you should be ok.
-Stut
--
http://stut.net/