When posting to a form, I get this error:
'date' is not a recognized built-in function name.
/insert_reviews.asp, line 43
Below is the code. Line 43 is the cn.execute(sql) but I don't think that is the correct line, of course.
From looking at the form, I don't think the date is passed though. I did try to change
sql = sql & " VALUES ('"& strName &"', '"& email &"', '"& review &"', '"& subject &"', date(), 1, "& rating &", "& linkID &")"
to
sql = sql & " VALUES ('"& strName &"', '"& email &"', '"& review &"', '"& subject &"', postDate(), 1, "& rating &", "& linkID &")"
and received a similar error:
'postDate' is not a recognized built-in function name.
/insert_reviews.asp, line 43
Hopefully that is enough for y'all. Thanks!
<!--#include file="config.asp"-->
<!--#include file="includes/func_common.asp"-->
<%
catID = int(request.form("catID"))
linkID = int(request.form("linkID"))
strName = replace(trim(request.form("name")), "'", "''")
email = replace(trim(request.form("email")), "'", "''")
subject= replace(trim(request.form("subject")), "'", "''")
review = replace(trim(request.form("review")), "'", "''")
rating = int(request.form("rating"))
e = 0
if len(strName) > 140 then
msg = "Name field can not be longer than 240 characters !"
e = e + 1
elseif len(strName) < 5 then
msg = "Name field can not be shorter than 15 characters !"
e = e + 1
end if
if len(subject) > 240 then
msg = "Subject field can not be longer than 240 characters !"
e = e + 1
elseif len(subject) < 10 then
msg = "Subject field can not be shorter than 15 characters !"
e = e + 1
end if
if len(review) > 250 then
msg = "Review field can not be longer than 240 characters !"
e = e + 1
elseif len(review) < 150 then
msg = "Review field can not be shorter than 150 characters !"
e = e + 1
end if
if e = 0 then
Set cn = Server.CreateObject ("ADODB.Connection")
cn.open strCon
sql = "insert into Reviews (name, email, review, subject, postDate, approve, rating, linkID)"
sql = sql & " VALUES ('"& strName &"', '"& email &"', '"& review &"', '"& subject &"', date(), 1, "& rating &", "& linkID &")"
cn.execute(sql)
sql = "update Links set rating = (rating + "& rating &"), cVotes = (cVotes + 1) where linkID = "& linkID &""
cn.execute(sql)
msg = "Your review added to our database.<br>Your review will appear online pending approval."
end if
rsp = appUrl & "/links/"& linkID &".asp?msg=" & server.urlencode(msg)
response.redirect rsp
%>
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
Select allOpen in new window
by: DanielWilsonPosted on 2009-08-21 at 16:16:29ID: 25156675
date and postDate are not being passed in.
If you want the current date, use the appropriate function for your DB.
If you're using MS SQL Server, that's getdate()