Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 1st, 2004, 09:56 PM
Authorized User
 
Join Date: Jun 2003
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to tp194
Default Counter

Hi

I'm trying to create a counter using javascript where when the user hits submit, the counter value gets put into a database as a numeric value.

Each time the user hit's submit, the counter value is incremented by 1, which would in turn get put into the database with the rest of the values.

Once the user has finished entering all the info, they can then close out the window.

I'm having problems figuring this out, so any help is greatly appreciated.

Thanks so much.

Terry

 
Old September 2nd, 2004, 08:02 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

So in your server-side code just have the receiving page of the form open a connection to a database and run a SQL statement such as:
Code:
UPDATE tblHits Set Counter = Counter + 1 WHERE Username = 'Fred'
You would create the SQL dynamically and replace Fred with the actual value. Or beeter still write a stored procedure to accept a userbname and update the table if your database supports them.

--

Joe





Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping with a counter? salhabb XSLT 0 October 4th, 2005 05:09 AM
Hit Counter Help! NeilS21 Classic ASP Databases 4 April 29th, 2005 06:59 AM
counter keeps reseting FlashMan Classic ASP Professional 7 September 30th, 2004 12:56 PM
counter Adam H-W Classic ASP Basics 15 August 15th, 2003 11:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.