Visitors:
/////////////////////////////////////////////////////////
// Designed by DWD 10/2/2003 //
// //
// YOU DO NOT HAVE TO CHANGE ANYTHING. //
// //
// JUST CUT AND PASTE EVERYTHING INTO YOUR HTML WHERE //
// YOU WANT THE COUNTER. //
/////////////////////////////////////////////////////////
// 1. establish id
$id = 6;
// 2. database connect info
$hostname_conn_counter = "localhost";
$database_conn_counter = "counter";
$username_conn_counter = "dwd_counter";
$password_conn_counter = "m4jcv34";
// 3. connect and retrieve data
$conn_counter = mysql_pconnect($hostname_conn_counter, $username_conn_counter, $password_conn_counter) or die(mysql_error());
mysql_select_db($database_conn_counter, $conn_counter);
$query_Recordset_count = "SELECT * FROM counting WHERE ID = $id";
$Recordset_count = mysql_query($query_Recordset_count, $conn_counter) or die(mysql_error());
$row_Recordset_count = mysql_fetch_assoc($Recordset_count);
// 4. add '1' to count
$count_total = $row_Recordset_count['counter']+1;
// 5. write new count to database
if (mysql_query("UPDATE counting SET counter = '".$count_total."' WHERE ID = '".$id."'")) {
$new_total = $count_total;
} else {
$new_total = "error";
}
// 6. write count to screen
echo $new_total;
// 7. Free mySQL
mysql_free_result($Recordset_count);
?>
since Sep 2002
Updated: print(date( |