This isn't an answer to your question, but from what I can see in your coding, you're allowing SQL injection attacks. This can be fixed by making this function:
function sql_quote($data) {
if (get_magic_quotes_gpc() == 1) {
$data = stripslashes($data);
}
return addslashes($data);
}
Then putting sql_quote($_GET['id']) or anything taken in by POST or GET 🙂