|
| |
|
|
BeTheBall
Posts: 6362 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Adding counters to records in db - 3/20/2004 10:00:55
Welcome to Outfront. If you are using the wizard, just open your page and insert a database results region above the one that shows the results. In step 2 of the wizard, select Custom Query and in the subsequent dialogue box, enter your SQL as above: UPDATE table1 set TimesViewed= TimesViewed + 1 WHERE (ID = ::ID::) In step 3, click "More Options and clear out the text box where "No records returned" appears. In step 4, uncheck the 3 check boxes and in step 5, mark "display all records together". If you are using "Pure ASP", I would simply insert the code to perform the update at the very top of the page, even before the <head>. Hope that helps.
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
99bird
Posts: 15 Joined: 3/19/2004 Status: offline
|
RE: Adding counters to records in db - 3/20/2004 12:40:56
Thanks Duane for the reply. I tried adding the second results region on the page as instructed and It didn't work. I get this error. "Database Results Error The operation failed. If this continues, please contact your server administrator" on the page. Is the statement correct? Any suggestions? As for your second suggestion, How would I go about adding the statement? I don't have a clue! Could you or anyone steer me in the right direction. Thanks again for your help.
|
|
|
|
BeTheBall
Posts: 6362 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Adding counters to records in db - 3/20/2004 14:58:29
Follow the direction in this post to get the true error: http://www.frontpagewebmaster.com/m-175524/mpage-1/key-operation%252Cfailed//tm.htm#175524
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
99bird
Posts: 15 Joined: 3/19/2004 Status: offline
|
RE: Adding counters to records in db - 3/20/2004 15:20:36
Duane. I got it to work by changing the statement to UPDATE table1 SET TimesViewed = TimesViewed + 1 WHERE (ID = ID) but it updates the counts on every record in the database not just the induvidual record that is being viewed on the results page. Any Ideas? Al
|
|
|
|
BeTheBall
Posts: 6362 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Adding counters to records in db - 3/20/2004 15:31:57
How are users getting to the results page? Via a link or by filling out a search form. Either way the code should not choke on ::ID::. What type of field is ID in the datebase? Hopefully numeric. Please go back to the previous code and follow the instructions in the link I gave you in my last post so we know what error is begin triggered. It appears that the ID is not being passed to the page. Also, if you have a link, please post it.
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
99bird
Posts: 15 Joined: 3/19/2004 Status: offline
|
RE: Adding counters to records in db - 3/20/2004 19:27:55
The users getting to the results page? Via a link. newinv.asp?=<%=FP_FieldURL(fp_rs,"VehId")%> Yes, the VehId and views fields in the datebase are numeric. The statement UPDATE tblVehicles SET views= views + 1 WHERE (VehId = ::VehId::) now works without getting an error. The error was due to s-columnnames and s-columntypes. So I added "VehId,views" in the s-columnnames and "3,3" in the s-columntypes. The error is now gone. But the count is not updated. In the address bar when you go to the results page shows the infomation http://www.krenekrv.com/used/newinv.asp?VehId=439 on it brings up the proper results. It soulds like you are correct in saying that the VehId is not being passed to the page where it can be picked up. Any other ideas? Thanks again! Al
|
|
|
|
BeTheBall
Posts: 6362 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Adding counters to records in db - 3/21/2004 12:16:58
You too may want to try what I mentioned in my last post in this topic: http://www.frontpagewebmaster.com/m-182756/tm.htm
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
99bird
Posts: 15 Joined: 3/19/2004 Status: offline
|
RE: Adding counters to records in db - 3/23/2004 20:55:00
Duane, Finally got it working by adding s-columnnames and s-columntypes values and changing the statement as follows; UPDATE tblVehicles SET [views]= views + 1 WHERE ([VehId] = ::VehId::) Don't ask me how or why it works......but it works. However I did find that when I did a test page created from scrach in a test site using FP2002 it worked with out any changes. But in this site using FP2003 it didn't. In reaseaching, I have seen post about issues resulting from switching from FP2002 to FP2003 and this type of things. Thanks again for all your help.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|