So I've looked up many tutorials on how to get variables like http://example.net/pb.php?id=1&affsub=stringhere&key=123abc and then when that page is accessed I want it to be put into my database. But I have tried doing so by using this piece of code. And when accessing the page using ?id=1&affsub=stringhere&key=123abc it doesn't show any errors on the page and it also doesn't put it in the database as well. Now I'm not sure what is happening or what I need to do for that to work.
<?
if( $_POST )
{
  $con = mysql_connect("localhost","user","pass");
  if (!$con)
  {
    die('Could not connect: ' . mysql_error());
  }
  mysql_select_db("tbl", $con);
  $id = $GET['id'];
  $affsub = $_GET['affsub'];
  $key = $_GET['key'];
  $id = mysql_real_escape_string($id);
  $affsub = mysql_real_escape_string($affsub);
  $key = mysql_real_escape_string($key);
  $query = "
  INSERT INTO `tbl`.`users` (`id`, `affsub`, `key`) VALUES ('$id',
        '$affsub', '$key');";
  mysql_query($query);
  echo "<h2>User added to system.</h2>";
  mysql_close($con);
}
?>
 
    