Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


INSERT INTO PROBLEMS!!!

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,202
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> INSERT INTO PROBLEMS!!!
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 INSERT INTO PROBLEMS!!! - 6/22/2001 5:22:21 PM   
  pulga

 

Posts: 1
Score: 0
Joined: 6/22/2001
From: USA
Status: offline
Hey all,
Hope this finds everyone well. I'm trying to use a little VB to get some user info from an off-line user manual that I write for my company's software. I've gotten something from Nathan Schmoll at aspalliance.com. He provides a nice little .asp patch to pass all my links through. FE: if I want a link to a page called MRFastCine.html, I pass it through this asp page guide.asp. The link is: guide.asp?/MRFastCine.html. The code is below:

<%
tg=request.querystring
if tg="" then
%>You must enter a target URL.<%
else
set myconn=server.createobject("ADODB.Connection")
myconn.open _
"Driver={Microsoft Access Driver (*.mdb)}; _
DBQ="&server.mappath("track.mdb")&";"
sql_query="SELECT * FROM trackdb"
set rs=myconn.execute(sql_query)
WHILE NOT RS.EOF
dburl=rs("url")
if dburl=tg then
matchup="1"
end if
rs.movenext
wend
if matchup="1" then
sql_query="SELECT * FROM trackdb WHERE url='"&tg&"'"
set rs=myconn.execute(sql_query)
oldcountnumber=rs("count")
sql_query="UPDATE trackdb SET _
count='"&(cint(oldcountnumber)+1)&"' _
WHERE url='"&tg&"'"
myconn.execute(sql_query)
else
sql_query="INSERT INTO trackdb (url, count) _
values ('"&tg&"', '1')"
myconn.execute(sql_query)
myconn.close
end if
response.redirect(tg)
end if
%>

Unfortunately, while this is nice, I need more information, so I've been trying to add to the information inserted. I've created a different table to handle ip, browser, referer, date and time. But the damn thing won't work. It keeps telling me that the values for ip, browser, referer, date and time are zero. Does anyone see anything wrong below? Please advise. Many thanks in advance. Omochango

<%

tg=request.querystring
if tg = " " then
ip = Request.ServerVariables("REMOTE_ADDR")
referer = Request.ServerVariables("HTTP_REFERER")
browser = Request.ServerVariables("HTTP_USER_AGENT")
date = date()
time = time()
%>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>

You must enter a target URL.<%
else
set myconn=server.createobject("ADODB.Connection")
myconn.open "Driver={Microsoft Access Driver (*.mdb)}; DBQ="&server.mappath("guide.mdb")&";"
sql_query="INSERT INTO users (ip, referer, browser) values ('"&ip&"', '"&referer&"', '"&browser&"', '&date&','&time&')"
myconn.execute(sql_query)
sql_query="SELECT * FROM guide"
set rs=myconn.execute(sql_query)
WHILE NOT RS.EOF
dburl=rs("url")

if dburl=tg then
matchup="1"
end if

rs.movenext
wend
if matchup="1" then
sql_query="SELECT * FROM guide WHERE url='"&tg&"'"
set rs=myconn.execute(sql_query)
oldcountnumber=rs("count")
sql_query="UPDATE guide SET count='"&(cint(oldcountnumber)+1)&"' WHERE url='"&tg&"'"
myconn.execute(sql_query)
else

sql_query="INSERT INTO guide (url, count) values (' "&tg&" ', '1')"
myconn.execute(sql_query)
myconn.close
end if

response.redirect(tg)
end if
%>

******************************
Maferefun Chango baba mi ati gbobo Oricha!!!
Titi lae oba koso!! Titi lae obo oyo!! Kabiesile Kawo e!!!
**************************
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> INSERT INTO PROBLEMS!!! Page: [1]
Jump to:





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