Forums

PHP

This topic is locked

Record Views

Posted 04 Jan 2002 00:29:39
1
has voted
04 Jan 2002 00:29:39 Paul Gowder posted:
I want to track the number of views of a record. So I have views field in my database.

How can I create an automatic update function to add 1 to the count using php with phakt??



Replies

Replied 04 Jan 2002 02:23:35
04 Jan 2002 02:23:35 Tim Green replied:
You would need to create a custom update code block after the recordset is created using the same parameters that were used in your Recordset.

By far the easiest way to do this, would be to take your recordset code block and add to it (though this would mean that the recordset would no longer be editable within UltraDev).

Take this for example:-

<?php
$Recordset1=$connCart->Execute("SELECT * FROM articles WHERE month = '" . ($Recordset1__MMColParam) . "'" or DIE($connCart->ErrorMsg());
$updRS=$connCart->Execute("UPDATE articles SET views=views+1 WHERE month = '" . ($Recordset1__MMColParam) . "'" or DIE($connCart->ErrorMsg());
$Recordset1_numRows=0;
$Recordset1__totalRows=$Recordset1->RecordCount();
?>

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Reply to this topic