I finally got it to work with the following:
<?php
$db_name = "database";
$link = mysql_connect("localhost", "user", "passwd") or die("Could not connect to server!");
$qresult = parse_url($HTTP_REFERER, PHP_URL_QUERY);
$getidnum = explode("act=article&id=",$qresult);
$idnum =...