Thread: PHP Question
View Single Post
Old 04-18-2005, 03:05 PM  
nmcog
Confirmed User
 
Join Date: Sep 2004
Posts: 825
PHP Question

I've done a sponsor click tracking script with a MySQL database, it works so far, but is this the efficient code (least strain on the server, etc.)

It will be called up 10,000/day.

go.php
Code:
<?

$username = 'username';
$password = 'password';
$database = 'database';
$hostname = 'localhost';

mysql_connect($hostname, $username, $password);
mysql_select_db($database);

$domain = $_GET['site'];

mysql_query("UPDATE Sponsors SET Clicks=Clicks+1 WHERE Domain='$domain'");

$result = mysql_query("SELECT URL FROM Sponsors WHERE Domain='$domain'") or die ("Invalid entry!");
$output = mysql_fetch_row($result);
$url = ($output[0]);

mysql_close();

header("Location: $url");

?>
nmcog is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote