mysql - how to make simple visitor increase in php? -
i'm trying create simple visitor counter in php .when i'm running not know why not change , stays 1 .any appreciate .
<?php mysql_connect("localhost","root","")or die ("couldnt connect database"); mysql_select_db("coursenligne") or die ("couldnt find database"); $find_counts = mysql_query("select * user_counter"); while ($row = mysql_fetch_assoc($find_counts)) { $current_counts = $row['counts']; $new_count=$current_counts + 1 ; $update_count = mysql_query("update `coursenligne`.`user_count` set `counts` = $new_count"); echo $new_count; } ?> -- dumping database structure coursenligne create database if not exists `coursenligne` /*!40100 default character set utf8 collate utf8_unicode_ci */; use `coursenligne`; -- dumping structure table coursenligne.user_counter create table if not exists `user_counter` ( `counts` int(11) not null, primary key (`counts`) ) engine=innodb default charset=utf8 collate=utf8_unicode_ci; -- dumping data table coursenligne.user_counter: ~1 rows (approximately) /*!40000 alter table `user_counter` disable keys */; insert `user_counter` (`counts`) values (0);
it looks trying update user_count instead of user_counter.
Comments
Post a Comment