For every 1 added to the DB

Results 1 to 2 of 2

Thread: For every 1 added to the DB

  1. #1
    Join Date
    Dec 1969
    Posts
    2,238

    Default For every 1 added to the DB

    what would be a good way to add +1 to a new counter everytime a Name and Email addie is added to a database?<BR><BR>What I am doing is promoting my website using a contest, and I am going to have the drawing after 2000 entries.<BR>I have all the forms set up and the db is filled with the form results. Now I just need to show a public counter to count each database entry.<BR><BR>Thanks so much,<BR>Daniel<BR>for reference here is the page http://www.youreq.com/commerce/tellafriend.asp

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: For every 1 added to the DB

    Is the counter and the Name/Email in the same table? If it is or is not, you can just create a stored procedure that you call for adding a name and email:<BR><BR>CREATE PROCEDURE sp_AddContestant(@Name varchar(50), @Email varchar(100))<BR>AS<BR><BR>-- Insert the name and email<BR>INSERT INTO MyTable1 (Name, Email) VALUES(@Name,@Email)<BR><BR>-- Now, update the counter<BR>UPDATE SomeOtherTable<BR>SET Counter = Counter + 1<BR><BR><BR>Hope that helps! Happy Programming!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •