The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

MySQL newbie dilema

//Try to connect to database
mysql_connect("$dbhost","$db","$db")
or die("Unable to connect to SQL server!");
@mysql_select_db("$db")
or die("Unable to select database!");

//Get the URL to send the person to from the User database
$RESULT = mysql_query("SELECT * from $userdatabasetable where acct=\"$acct\"");
$row = mysql_fetch_array($RESULT);
$URL = $row['URL'];

//Load up the account's record from the MySql tabel
$result = mysql_query("SELECT * from $table where acct=\"$acct\" and date=\"$date\" ");

//If the record doesn't exist
if(!mysql_num_rows($result)) {

//Check if new record for today should be created, if true then create one
If ($date != $recorddate)
{
mysql_query("INSERT into $table (DATE, ACCT) VALUES ('$date','$acct')");
$result = mysql_query("SELECT * from $table where acct=\"$acct\" and date=\"$date\" ");
}
}

//Add a regular hit out to the record
//Add one more regular hit out to the current amount of regular hits
$hitsout++;
mysql_query("update $table set HITSOUT=\"$hitsout\" WHERE acct=\"$acct\" and date=\"$date\" ");

//Check if we should add a unique hit out to the record
//Check to see if the IP address of the user has changed first
if ($REMOTE_ADDR != $lastipout) {

//Add 1 more unqiue hit to the current amount of Uniques
$uniqueout++;
//Replace the IP on record with the current IP and adds a unqiue hit
#mysql_query("update $table set LASTIPOUT=\"$REMOTE_ADDR\" and set UNIQUEOUT=\"$uniqueout\" WHERE acct=\"$acct\" and date=\"$date\" ");
#Old Code -
mysql_query("update $table set UNIQUEOUT=\"$uniqueout\", LASTIPOUT=\"$REMOTE_ADDR\" where acct=\"$acct\" and date=\"$date\" ");
}

header("Location: $URL");

?>

this is the whole script to the thing i want to add on my website, where do I put in my MySQL information and can I make this script work with a countdown ? Please respond soon and if u can, AIM me at DBallerz, thanx in advance with your posts

BTW, is it a good idea to name the config file xchange.cfg?
I would add a ".php" at the end (or change the http server config to process .cfg as php), otherwise it's possible for people to request the cfg file and read the mysql username, password etc