The time has come where we need to update our database. This is done in the file
pollResults.asp. You may have noticed that this was the file specified in the FORM's
ACTION tag. So, let's ask ourselves, "What does
pollResults.asp need to do?" The answer is
simple: increment the Votes column for the correct PollOption. We have all the information we need from
the previous page, so let's get to it.
That's all there is to it. Pretty simple, eh? We just update the
Votes column by one. We then set a cookie to indicate that this user has
voted (the cookie is set to expire tomorrow... you can extend this if you like...), and we redirect them
back to the page we came from!
|The Dreaded "Operation must use an updateable query" Error|
A number of users have informed me that when trying to run this script
they are receiving |
We've only got one part left to this system, and that is displaying the results! The code that displays the results exists within the same file as the code that shows the voting options. I know it doesn't seem like that, but that's because I wanted to show you just the voting aspect first. For a clearer understanding, you'll want to look through the code, which is available in full at the end of this article...
So, let's go on to Step 4!