redirects

I have installed a redirect script "goredirect" that changes outboud urls like

www.amazon.com
to
www.techrebate.com/go.php?id=34

It installed fine, but once I click on my newly made links in postnuke, it has an error like this:

Code

Warning: mysql_free_result(): supplied argument is not a valid mysql result resource in /home/techreba/public_html/go.php on line 77

Warning: mysql_close(): supplied argument is not a valid MySQL-link resource in /home/techreba/public_html/go.php on line 78


So... naturally I went back into the script go.php, which looks like this:

Code

/********************************************
data capture section - server variables
*********************************************/

$linkid=$_GET['id'];
$visitorip= $_SERVER['REMOTE_ADDR'];
$visitorurl= $_SERVER['HTTP_REFERER'];
$visitorbrowser= $_SERVER['HTTP_USER_AGENT'];
$visitorpage=$_SERVER['REQUEST_URI'];

/********************************************
upload the data into the database
*********************************************/

$insertquery="INSERT INTO stats (ip,url,browser,date,page,linkid,sitecode) VALUES ('$visitorip','$visitorurl','$visitorbrowser',NOW(),'$visitorpage',$linkid,'$sitecode')";
// echo $insertquery;
$result=mysql_query($insertquery) or die(mysql_error());

/********************************************
redirect the user
*********************************************/

$sqlredir="SELECT * FROM redirs WHERE id=$linkid";
$rdresult=mysql_query($sqlredir) or die(mysql_error());
$row=mysql_fetch_assoc($rdresult) or die(mysql_error());
$rdurl="Location: ".$row['redirect'];
header($rdurl);

/********************************************
shut down the SQL connection and flush
*********************************************/

mysql_free_result($rdresult);
mysql_free_result($result);
$goodbye=mysql_close($conn);


The lines 77 and 78 are the last 2 lines of the code

Code

mysql_free_result($result);
$goodbye=mysql_close($conn);


Any body have any ideas? Thanks for your time
Glen
I would say that those two mysql functions are not working because you are missing "a valid MySQL result resource"...

Your connection is failing, check your logon/pass/dbname/etc.

St.Ego

I would say that those two mysql functions are not working because you are missing "a valid MySQL result resource"...

Your connection is failing, check your logon/pass/dbname/etc.
I already checked the connections and everything.... it's not that. I am a psuedo-noob with scripts, and I don't really know much. Thanks for the help Sgt. Ego. Any more suggestions would still be great :)