|
[ Autoren gesucht! ]
|
PHP-Homepage.de sucht laufend Autoren für News und Artikel
Interesse?
|
|
 |
|
[Start] [Suche] [Neue Einträge]
| MySQLCounter | <?php
//MySQLCounter 0.2 by Kowalski Boris 01.2001
include("/config.php3");
//config.php3 is where the $MySQL_xxx Variables are set
//connect to database
$db = mysql_connect("$MySQL_hostname","$MySQL_username","$MySQL_password");
if ($db)
{
mysql_select_db($database);
//reading value from database
$query_question = "SELECT value FROM $counter_table WHERE counter=\"$ID\"";
$query_mid = mysql_query($query_question);
$query = mysql_fetch_array($query_mid,MYSQL_ASSOC);
//calculate the new value for counter
$new_value = $query[value]+1;
//writing the new value
$update_query = "UPDATE $counter_table SET value=$new_value WHERE counter=\"$ID\"";
$updating_db = mysql_query($update_query);
echo "$new_value";
//close database
mysql_close();
}
?> |
|