crazy rabbit
|
Posted: 06/05/2004, 7:48 PM |
|
hi. i want update a record of a table when you open this page. for example, when you read on of the article of my site, the record -"article_views" will changed into "article_views+1"
thanks
|
|
|
carzy rabbit
|
Posted: 06/05/2004, 7:49 PM |
|
sorry, it should is "when you read one of the article of my site" , its "one" not "on"
|
|
|
ghtracey
Posts: 23
|
Posted: 06/07/2004, 12:59 PM |
|
Assuming your connection is named Connection your articles table has the field ViewCount and is indexed by ArticleID(integer), and you pass ArticleID to the page as a parameter.
in BeforeShow()
if (CCGetParam("ArticleID") <> "") {
$db = new clsDBConnection;
$db->query("UPDATE articles SET ViewCount = ViewCount + 1 WHERE ArticleID=".$db->ToSQL(CCGetParam("ArticleID),ccsInteger));
unset($db);
}
_________________
Graham Tracey
Council of Yukon First Nations |
|
|
|