Re: How do I delete a composite key?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux