I've got a very simple song download popularity checker set up, utilizing the META refresh tag. The META tag works fine, of course. But the MySQL is apparently not working fine. I've been trying to use this through PHP:
mysql_connect("host:port","username","password") or die ("Database Connection Error.");
$query = "UPDATE audio_stats SET hits=hits+1 WHERE songID=$song";
Now, this is the first thing I've actually tried to do with MySQL (aside from a couple tutorial things). the $song variable is passed through the URL, and is also echoed in the META tag, so I know it's fine. And I tried "UPDATE audio_stats SET hits=hits+1 WHERE songID=$song" through phpMyAdmin & it updated the database table as expected (using a relevant songID..not the variable of course). But I cannot get it to update through the actual webpage. Any ideas?
If you are sending a cookie in the header it is wise not to send a header Location tag at the same time - this can mess up in some browsers and result in the cookie not being written. For that reason I personally always use a META refresh tag to redirect if I'm sending a cookie at the same time.