Hmm, I was having a small problem with using the redirection script. As I am linking to a page that updates a database with every hit the script used, I have found that readfile() works best. However, I have hit a snag.
Once testing the script, I noticed that the database does not update when used in Firefox, but it does in IE, and Netscape (havent tested other, but I assume they will work for now). The code that I am using is below:
Code: Select all
<?PHP
header("Content-type: image/gif");
include('connection.php'); // Include connection to database
// Update the hits
$sql = "UPDATE database SET hits=hits+1 WHERE num='$num'";
$rs = mysql_query($sql) or die(mysql_error());
// Get the right image to display
$sql2 = "SELECT banner FROM database WHERE num='$num'";
$rs2 = mysql_query($sql2) or die(mysql_error());
$get = mysql_fetch_assoc($rs2);
$banner = $get['banner'];
switch ($banner) {
case '1' : readfile("file1.gif");
break;
case '2' : readfile("file2.gif");
break;
default : readfile("file3.gif");
break;
}
?>
I get the banner fine, the image shows perfectly, but for some reason, the database does, as I said, not update.
Does anybody have any idea's why this might be?
Thanks,
Archy