Hey, globals are registered but its still not working. Here is my code:
<?php
//Connect to database
include("connectdb.inc.php");
//Find the top five users in the database
$querytop= mysql_query( "select outwarusername, outwarlink, points, clicks from outwarinfo order by points desc limit 5" );
while ( $row=mysql_fetch_array($querytop) )
{
//Add all the results to variables for easy acccess
$outwarname=$row[outwarusername];
$outwarlink=$row[outwarlink];
$outwarpoints=$row[points];
$outwarclicks=$row[clicks];
//Print the table with all the variables in it,also store information for point deducting
print "<table><tr><td width=150>$outwarname</td><td width=300><a href=\"testindex.php?UserId=$outwarname\"
target=\"_blank\">$outwarlink</a></td><td width=100>$outwarpoints</td><td width=\"100\">$outwarclicks
</td></tr></table>";
}
//Set id to null out of the loop
$id=0;
?>
Recieving script:
deductpoint.php
<?php
$userid=$_GET['UserId'];
include ("connectdb.inc.php");
//Deduct point from user
$queryusername=mysql_query( "select points from outwarinfo where outwarusername=\"$userid\" " ) or die ("Sorry could not select user");
$getusernamearray=mysql_fetch_array($queryusername) or die("Sorry could not fetch array");
$pointsuser=$getusernamearray[points];
$pointdeduct=1;
$newpointamount=$pointsuser - $pointdeduct;
mysql_query("update outwarinfo set points=$newpointamount where outwarusername=\"$userid\" ") or die ("Sorry could not update points");
//Add one to clicks column
$addclickquery=mysql_query( "select clicks from outwarinfo where outwarusername=\"$userid\" " ) or die ("Sorry could not select clicks");
$addclickarray=mysql_fetch_array($addclickquery) or die("Sorry could not fetch click array");
$clickuser=$addclickarray[points];
$clickadd=1;
$newclickamount=$clickuser + $clickadd;
mysql_query("update outwarinfo set clicks=$newclickamount where outwarusername=\"$userid\" ") or die ("Sorry could not update clicks");
?>
Anyhelp? Thanks, Jack