Forums

This topic is locked

Users Read Article

Posted 03 Mar 2005 15:20:20
1
has voted
03 Mar 2005 15:20:20 Mashkur Alam posted:
Hi,

Thinking to add a feature in my new site, how many users read the articles.

Is there any tutorial I can follow, how can I track the visitors?

Using

DWMX, ASP, VBScript, Access DB

Please advice

Regards

Babu

Replies

Replied 03 Mar 2005 20:41:22
03 Mar 2005 20:41:22 Vince Baker replied:
In the body you have:

<%=rsLdn_lets.Fields("ReadNumber"%>

should be getting the data from rsCount

<%=rsCount("ReadNumber"%>


Regards

Vince Baker
<strong>DMX Zone Manager</strong>

[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]
Replied 03 Mar 2005 20:49:36
03 Mar 2005 20:49:36 Mashkur Alam replied:
Hi Vince

Quite improved but with error on the page.

The page does execute

but on the top an error showing

INSERT INTO tbl_article_stats (article_stat_id) VALUES ('Seyssel Street, Docklands, London, E14, £185 pw')

and in the User read it = value 0

Babu
Replied 03 Mar 2005 20:56:17
03 Mar 2005 20:56:17 Vince Baker replied:
ok, that is not an error, where we stopped the command from executing by adding the ' and then we added the response.write line, instead of inserting it writes the command on the page.

this is a good trick to see what the error could be....

I cannot see anything wrong at this point so take out the quote mark and the response.write and lets see if it works.

Regards

Vince Baker
<strong>DMX Zone Manager</strong>

[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]
Replied 03 Mar 2005 21:00:31
03 Mar 2005 21:00:31 Mashkur Alam replied:
No it doesn't like it

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
/House/london_lets.asp, line 58


thats Execute point

Babu
Replied 03 Mar 2005 21:35:23
03 Mar 2005 21:35:23 Mashkur Alam replied:
TO BE Continued

Tomorrow

Bye for now

Babu
Replied 04 Mar 2005 01:17:47
04 Mar 2005 01:17:47 Dave Thomas replied:
wow, is this all just to have a counter on records?

theres a much easier way than what youve been doing upto now.

regards

Dave Thomas
<b>DMX Zone Manager</b>
Replied 04 Mar 2005 13:09:04
04 Mar 2005 13:09:04 Mashkur Alam replied:
Thanks for the reading my post. May be there are lot of way to do, but the problem is I don't know how to do that.

What I am looking for is, My site is contain Properties.....

So, on each property is tracing by Property_ID, I wanted to add a feature in to the table that how many clients have raed this Property_ID by Property Title, So this way I can show my clients demand of the property.

If you have something alternative, please....advice me how to do that.

Thanks again

Babu

Edited by - babui on 04 Mar 2005 13:10:42
Replied 04 Mar 2005 20:01:43
04 Mar 2005 20:01:43 Dave Thomas replied:
easily done buddy.

on my table holding the house info, add a column (number) (default 0) call it ViewCount or whatever.

now on your detail page for this particular property, locate the recordset code.

<pre id=code><font face=courier size=2 id=code>
rsLdn_lets.CursorType = 2
rsLdn_lets.CursorLocation = 3
rsLdn_lets.LockType = 1
rsLdn_lets.Open()

rsLdn_lets_numRows = 0
</font id=code></pre id=code>

and change it to read like so: (changes are in bold)

<pre id=code><font face=courier size=2 id=code>
rsLdn_lets.CursorType = <b>0</b>
rsLdn_lets.CursorLocation = <b>2</b>
rsLdn_lets.LockType = <b>3</b>
rsLdn_lets.Open()
<b>rsLdn("ViewCount" = rsLdn.Fields.Item("ViewCount".Value + 1</b>
<b>rsLdn.Update</b>
rsLdn_lets_numRows = 0
</font id=code></pre id=code>

this opens the recordset and updtes the ViewCount column by + 1 every time the page is viewed.

regards

Dave Thomas
<b>DMX Zone Manager</b>
Replied 07 Mar 2005 17:13:46
07 Mar 2005 17:13:46 Mashkur Alam replied:
Hi
thanks for the code..

I am trying to solve it from morning but can't get it right

I made a culum in DB name 'ViewCount' default value 0

Now in the MX code

Added the following:

Set rsLdn_lets = Server.CreateObject("ADODB.Recordset"
rsLdn_lets.ActiveConnection = MM_HouseConnection_STRING
rsLdn_lets.Source = "SELECT Region, Title, Short_Description, Type, Bedrooms, Per_week, Property_ID, Imain, ViewCount FROM myLet WHERE Title LIKE '" + Replace(rsLdn_lets__MMCOLParam, "'", "''" + "' ORDER BY Per_week ASC"
rsLdn_lets.CursorType = 0
rsLdn_lets.CursorLocation = 2
rsLdn_lets.LockType = 3
rsLdn("ViewCount" = rsLdn.Fields.Item("ViewCount".Value + 1 - - -(Line 23)
rsLdn.Update
rsLdn_lets.Open()

Getting an error in line 23

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'rsLdn'
/House/london_lets.asp, line 23

Could you please tell me, where is the problem?

Look forward from you.

Babu

Edited by - babui on 07 Mar 2005 17:14:27
Replied 07 Mar 2005 19:00:15
07 Mar 2005 19:00:15 Dave Thomas replied:
sorry the recordset is actually called rsLdn_lets

i had it as rsLdn

so change the lines

<pre id=code><font face=courier size=2 id=code>
rsLdn("ViewCount" = rsLdn.Fields.Item("ViewCount".Value + 1
rsLdn.Update</font id=code></pre id=code>

to

<pre id=code><font face=courier size=2 id=code><b>
rsLdn_lets("ViewCount" = rsLdn_lets.Fields.Item("ViewCount".Value + 1
rsLdn_lets.Update
</b></font id=code></pre id=code>

regards

Dave Thomas
<b>DMX Zone Manager</b>
Replied 07 Mar 2005 19:13:50
07 Mar 2005 19:13:50 Mashkur Alam replied:
Hi Dave

Thanks for showing me the way, its working now.

But this kind different things,

I am using in a Property list page look at the the example here:

www.housewithamouse.co.uk/london_lets.asp

Its updating just only one Property_ID, not the others, I am not sure how it works actually.

I think this method will work perfectly into the details page. But I was trying to do it in the List page.

So that when client visit the list page they can see how many users been this property.

Please advice me, is there any alternative I can do on this???

Regards


Babu

Edited by - babui on 07 Mar 2005 19:14:10
Replied 07 Mar 2005 19:41:11
07 Mar 2005 19:41:11 Mashkur Alam replied:
Hi Dave

Got another problem, if I use this cursor type, then it conflicts with my shopping cart Basket.

Don't know what to do. May be I can use it inside details page.

If you have any advice on this please let me know.

Many many thanks to -

Vince
Dave

Regards

Babu
Replied 07 Mar 2005 20:39:25
07 Mar 2005 20:39:25 Dave Thomas replied:
the code is meant to be on the detail page, as it updates the ID that is being viewed.

you show it in the list to for all properties by adding the following into your repeat region on the main page.

<pre id=code><font face=courier size=2 id=code>This record has been viewed &lt;%=(rsLdn_lets.Fields.Item("ViewCount".Value)%&gt; times. </font id=code></pre id=code>

this has no cursor change or update, as your only grabbing the value from the database to serve as a counter, so it should not conflict with anything.





regards

Dave Thomas
<b>DMX Zone Manager</b>
Replied 08 Mar 2005 14:34:16
08 Mar 2005 14:34:16 Mashkur Alam replied:
Hi Daves

Thanks a lot, problem solved, I am using it in to the detail page.......It is a realy nice feature, it will attract our client.

Once again thanks to -

Dave &
Vince

Regards

Babu

Reply to this topic