CMS system
Nu har jeg rodet rimeligt meget rundt i mit CMS-system og er rendt ind i et lille problem.Det der sker er, når jeg vil tilføje en opskrift, så kommer denne fejl frem;
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'id ='.
/systematic/opskrifter.asp, line 69
Jeg bruger disse tre filer for, det skulle kunne lade sig gøre;
sign_opskrifter.asp;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Systematics homekitchen</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<script language="JavaScript">window.status = ""</script>
<script language="javascript" src="validering_kokken.js"></script>
<style>@import url("systematic.css");
BODY { SCROLLBAR-FACE-COLOR: #ffffff;
SCROLLBAR-HIGHLIGHT-COLOR: #ff0000;
SCROLLBAR-SHADOW-COLOR: #cccccc;
SCROLLBAR-3DLIGHT-COLOR: #DFDFDF;
SCROLLBAR-ARROW-COLOR: #ff0000;
SCROLLBAR-TRACK-COLOR: #ffffff;
SCROLLBAR-DARKSHADOW-COLOR: #ffffff
}
</style>
</head>
<body>
<table width="680" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80"><img src="grafik/trans.gif" width="80" height="30" border="0"></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td valign="top" class="overskrifter"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2%"> <a href="java script: history.go(-1);" onFocus="this.blur()" target="_self">
<img src="grafik/trekant_tilbage.gif" width="12" height="17" border="0"></a></td>
<td width="2%"><img src="grafik/trans.gif" width="10" height="6"></td>
<td width="96%" class="overskrifter">Admin - tilføj opskrift</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><img src="grafik/trans.gif" width="6" height="15"></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
<td class="broedtxt"><form name="new_comment" action="add_opskrift.asp" method="post">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="96" height="30" class="mellemoverskrift"> Navn</td>
<td width="315" height="30"> <input name="navn" maxlength="46" type="text" class="inputfield" size="30">
<span class="broedtxt">max 46 tegn</span> </td>
</tr>
<tr>
<td height="30" valign="top" class="broedtxt"> <img src="grafik/trans.gif" width="6" height="2"><br>
<span class="mellemoverskrift">Opskrift</span> </td>
<td height="30"><textarea name="text" cols="39" rows="10" wrap="virtual" class="inputfield" id="text"></textarea></td>
</tr>
<tr>
<td> </td>
<td height="45"> <input type="hidden" name="StrMode" value="new_comment">
<input name="button" type="button" class="button" onFocus="this.blur()" onClick="validering()" value="tilføj opskrift">
</td>
</tr>
<tr>
<td height="30" colspan="2"> <table border="0" bordercolor="#000000" <% if Session("error") = true then response.write "cellpadding=""5""" else response.write "cellpadding=""0""" end if %> cellspacing="0">
<tr>
<td class="broedtxt" <% if Session("error") = true then response.write "bordercolor=""red""" end if %> >
<%
if Session("error") = true then
response.write "Following mistake has occured<br>" & Session("message")
Session("error") = false
end if
%> </td>
</tr>
</table></td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
add_opskrifter.asp;
<style type="text/css">
<!--
@import url("systematic.css");
-->
</style>
<%
'Set the response buffer to true as we maybe redirecting
Response.Buffer = True
strMode = request.form("strMode")
'If the session variable is False or does not exsist then redirect the user to the unauthorised user page
If strMode <> "new_comment" then
'Redirect to user start page
Response.Redirect "index.asp"
End If
'Dimension variables
Dim strInputComments 'Holds the Users comments
Dim saryCommentWord 'Array to hold each word in the comments enetred by the user
Dim intCheckWordLengthLoopCounter 'Loop counter
Dim intWordLength 'Holds the length of the word to be checked
Dim blnWordLenthOK 'Boolean set to False if any words in the description are above 80 characters
Dim intLongestWordLength 'Holds the number of characters in the longest word entered in the
'Read in user deatils from the kokken (DB users.db) form
strInputComments = Request.Form("text")
'Split-up each word in the comments from the user to check that no word entered is over 50 characters
saryCommentWord = Split(Trim(strInputComments), " ")
'Initialse the word length variable
blnWordLenthOK = True
'Loop round to check that each word in the comments entered by the user is not above 70 characters
For intCheckWordLengthLoopCounter = 0 To UBound(saryCommentWord)
'Initialise the intWordLength variable with the length of the word to be searched
intWordLength = Len(saryCommentWord(intCheckWordLengthLoopCounter))
'Get the number of characters in the longest word
If intWordLength => intLongestWordLength Then
intLongestWordLength = intWordLength
End If
'If the word length to be searched is more than or equal to 70 then set the blnWordLegthOK to false
If intWordLength => 80 Then
blnWordLenthOK = False
End If
Next
If blnWordLenthOK = True Then
Set Rs = Server.CreateObject ("ADODB.Connection")
set rec = server.createobject("ADODB.recordset")
Rs.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.MapPath("../Systematic/users.mdb")
Rec.open "opskrifter", Rs, 2, 3
Dim dato
dato = date()
Dim tid
tid = time()
navn = Request ("navn")
email = Request ("email")
comment = Request ("text")
if comment = "" then
comment = "Der er ikke indtastet nogen opskrift!"
end if
Rec.Addnew
Rec("nick") = navn
Rec("email") = email
Rec("text") = comment
Rec("dato") = dato
Rec("tid") = tid
REC.Update
Rec.close
set Rec=nothing
Response.redirect "opskrifter.asp"
else
Session("error") = true
Session("message") = "Beklager, men det er ikke lovligt at taste over 46 tegn!"
Response.redirect "sign_opskrifter.asp"
end if
%>
opskrift_link.asp;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Systematics køkken</title>
<META NAME="Generator" CONTENT="Stone's WebWriter 3.5">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
@import url(test/systematic.css);
-->
</style>
<style>
BODY { SCROLLBAR-FACE-COLOR: #ffffff;
SCROLLBAR-HIGHLIGHT-COLOR: #ff0000;
SCROLLBAR-SHADOW-COLOR: #cccccc;
SCROLLBAR-3DLIGHT-COLOR: #DFDFDF;
SCROLLBAR-ARROW-COLOR: #ff0000;
SCROLLBAR-TRACK-COLOR: #ffffff;
SCROLLBAR-DARKSHADOW-COLOR: #ffffff
}
</style>
<style type="text/css">
<!--
@import url("systematic.css");
-->
</style>
<style type="text/css">
<!--
.link {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FF0000;
text-decoration: none;
}
-->
</style>
<style type="text/css">
<!--
a:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #CCCCCC;
text-decoration: none;
}
-->
</style>
</head>
<body class="overskrifter">
<table width="680" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80"><img src="grafik/trans.gif" width="80" height="30"></td>
<td colspan="2"></td>
</tr>
<tr>
<td></td>
<td width="240" valign="top" class="overskrifter"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="grafik/overskrifter/opskrifter.gif" width="160" height="24"></td>
</tr>
<tr>
<td><img src="grafik/trans.gif" width="6" height="15"></td>
</tr>
</table></td>
<td width="360" valign="top" class="overskrifter"><form name="form1" method="post" action="search.asp">
<div align="right">
<input type="text" name="Keyword" size="30">
<input type="submit" value="søg opskrift" name="Action">
</div>
</form></td>
</tr>
<tr>
<td></td>
<td colspan="2" valign="top" class="broedtxt">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> <span class="link">
<%
' Databaseforbindelse - husk at angive sti til din database
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("users.mdb")
Conn.Open DSN
' SQL forespørgsel - asc = sætter opskrifterne i alfabetisk rækkefølge i forhold til 'nick' = navn på opskrift
strSQL = "Select * from opskrifter order by nick asc"
' Udfør forespørgsel (objRec indeholder nu resultatet)
Set objRec = Conn.Execute(strSQL)
do while not objRec.eof
comment = Replace(objrec("text"), vbCrLf, "<BR>")
response.write "<tr>"
response.write "<span class=""link""><a href=""opskrifter.asp?id=" & objrec("id") & """>" & objrec("nick") & "</a></span>"
response.write "</td></tr>"
objRec.movenext
loop
' Luk databaseforbindelse
Conn.Close
Set Conn = Nothing
%>
</span> </td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
Er der hurtigt hjælp at hente? Jeg bytter sikkert bare rundt på de forskellige filer, som jeg skal hente, fordi jeg nu har rodet rimeligt meget med dette system.
//D
