cheekynorton
Technical User
Please can someone help?
I get the following error when clicking on the post reply button when trying to reply to a post within a forum.
Error Type:
Microsoft VBScript compilation (0x800A03EA)
Syntax error
/Forum/files/post.asp, line 28, column 104
sql2 = "insert into messages (title, body, date_created, date_modified, user_id, parent_id) values ('" &
-------------------------------------------------------------------------------------------------------^
I can log into the forum, display the messages, view a single message but cannot reply.
I cant work out what is wrong with code.
Below is the code for post.asp page.
Any help would be appreciated
<%@LANGUAGE = "VBSCRIPT"%>
<%
if session("loggedin" = "" then
response.redirect("default.asp"
end if
%>
<%
if request("action" = "insert" then
Dim Conn, ConnString
Set Conn = Server.CreateObject("ADODB.Connection"
ConnString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=C:\inetpub\ Conn.Open(ConnString)
sql = "select id from users where username = '" & session("username" & "'"
Set RS = Conn.Execute(sql)
if len(request("parent_id") > 0 then
PID = request("parent_id"
else
PID = 0
end if
sql2 = "insert into messages (title, body, date_created, date_modified, user_id, parent_id) values ('" &
request("title" & "', '" & request("body" & "', " & RS("id" & ", '" & now & "', " & PID &
""
Conn.Execute(sql2)
Conn.close
response.redirect("list.asp"
else
%>
<html>
<head>
<title>Forum</title>
<STYLE TYPE="text/css">
font { font-family:verdana }
a { color:00000 }
a:visited { color: 000000 }
.cell { font-size:14px ; color:black }
.title { font-family:arial ; font-size:16px ; line-height: 18px ; font-weight:bold; vertical-align:top }
</STYLE>
</head>
<body bgcolor="E3EEEE">
<form name="myForm" action="post.asp" method="POST">
<input type="hidden" name="action" value="insert">
<input type="hidden" name="parent_id" value="<%=request("parent_id"%>">
<table width="450">
<tr>
<td bgcolor="19CBC5" width="150" class="title">Title:</td>
<td bgcolor="AAE4E2">
<input type="text" name="title" style="width:300" size="20"></td>
</tr>
<tr>
<td bgcolor="19CBC5" valign="top" class="title">Message:</td>
<td bgcolor="AAE4E2"><textarea name="body" rows="15" cols="40"></textarea></td>
</tr>
<tr>
<td bgcolor="19CBC5" colspan="2" align="center"><input type="submit"></td>
</tr>
</table>
</form>
</body>
</html>
<%end if%>
I get the following error when clicking on the post reply button when trying to reply to a post within a forum.
Error Type:
Microsoft VBScript compilation (0x800A03EA)
Syntax error
/Forum/files/post.asp, line 28, column 104
sql2 = "insert into messages (title, body, date_created, date_modified, user_id, parent_id) values ('" &
-------------------------------------------------------------------------------------------------------^
I can log into the forum, display the messages, view a single message but cannot reply.
I cant work out what is wrong with code.
Below is the code for post.asp page.
Any help would be appreciated
<%@LANGUAGE = "VBSCRIPT"%>
<%
if session("loggedin" = "" then
response.redirect("default.asp"
end if
%>
<%
if request("action" = "insert" then
Dim Conn, ConnString
Set Conn = Server.CreateObject("ADODB.Connection"
ConnString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=C:\inetpub\ Conn.Open(ConnString)
sql = "select id from users where username = '" & session("username" & "'"
Set RS = Conn.Execute(sql)
if len(request("parent_id") > 0 then
PID = request("parent_id"
else
PID = 0
end if
sql2 = "insert into messages (title, body, date_created, date_modified, user_id, parent_id) values ('" &
request("title" & "', '" & request("body" & "', " & RS("id" & ", '" & now & "', " & PID &
""
Conn.Execute(sql2)
Conn.close
response.redirect("list.asp"
else
%>
<html>
<head>
<title>Forum</title>
<STYLE TYPE="text/css">
font { font-family:verdana }
a { color:00000 }
a:visited { color: 000000 }
.cell { font-size:14px ; color:black }
.title { font-family:arial ; font-size:16px ; line-height: 18px ; font-weight:bold; vertical-align:top }
</STYLE>
</head>
<body bgcolor="E3EEEE">
<form name="myForm" action="post.asp" method="POST">
<input type="hidden" name="action" value="insert">
<input type="hidden" name="parent_id" value="<%=request("parent_id"%>">
<table width="450">
<tr>
<td bgcolor="19CBC5" width="150" class="title">Title:</td>
<td bgcolor="AAE4E2">
<input type="text" name="title" style="width:300" size="20"></td>
</tr>
<tr>
<td bgcolor="19CBC5" valign="top" class="title">Message:</td>
<td bgcolor="AAE4E2"><textarea name="body" rows="15" cols="40"></textarea></td>
</tr>
<tr>
<td bgcolor="19CBC5" colspan="2" align="center"><input type="submit"></td>
</tr>
</table>
</form>
</body>
</html>
<%end if%>