View Single Post
  #1 (permalink)  
Old 10-10-09, 03:53 PM
justin.g justin.g is offline
New Member
 
Join Date: Oct 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Syntax error (missing operator) in query expression 'MESSAGES.CAT_ID ='.

This is the error I am getting. Can somebody please help me out. Its probably something stupid I did wrong.

Syntax error (missing operator) in query expression 'MESSAGES.CAT_ID ='.
/forum/CAForum/admin/inc_forums.asp, line 38


here is the asp code:
asp Code:
  1. <%
  2. connSTR = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("CAForum.mdb")
  3. %>
  4.  
  5.  
  6. <table width="100%" cellspacing="0" cellpadding="1" align="center" border="1" ID="Table1">
  7.  
  8.  
  9. <tr>
  10. <td>
  11. <a href="post.asp">>>Post new message</a>
  12. </td> </tr></table>
  13.  
  14.  
  15. <%
  16. Dim intPage,intCat_Id
  17. intPage = Request.QueryString("page")
  18. intCat_Id=Request.QueryString("iCat_id")
  19.  
  20. If intPage <> "" Then
  21.    If IsNumeric(intPage) Then
  22.       If intPage < 1 Then
  23.          intPage = 1
  24.       End If
  25.    Else
  26.       intPage = 1
  27.    End If
  28. Else
  29.    intPage = 1
  30. End If
  31.  
  32. set rsForums = Server.CreateObject("ADODB.Recordset")
  33. rsForums.ActiveConnection = connSTR
  34. rsForums.Source = " SELECT * FROM (SELECT *, (SELECT COUNT (*) FROM REPLIES WHERE REPLIES.MSG_ID = MESSAGES.MSG_ID) AS REP_COUNT FROM MESSAGES, CATEGORIES WHERE CATEGORIES.CAT_ID = MESSAGES.CAT_ID) WHERE MESSAGES.CAT_ID = " & intCat_Id & " ORDER BY MSG_LAST_POST DESC"
  35. rsForums.CursorType = 3
  36. rsForums.CursorLocation = 2
  37. rsForums.LockType = 3
  38. rsForums.CacheSize = 10
  39. rsForums.PageSize = 10
  40.  
  41. rsForums.Open() %>
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48. <table width="100%" cellspacing="0" cellpadding="1" align="center" border="1">
  49. <TR class="Header">
  50.           <TD  width=70% height="16" align="left" valign="middle">TOPIC</TD>
  51.           <TD width=10% height="16" align="center" valign="middle">POSTED</TD>
  52.           <TD width=10% height="16" align="center" valign="middle">REPLIES</TD>
  53.           <TD width=10% height="16" align="right" valign="middle">LAST POST</TD>
  54. </TR>
  55.  
  56.  
  57.  
  58.    
  59. <%
  60.  
  61. If Not rsForums.EOF Then
  62.      If CInt(intPage) > CInt(rsForums.PageCount) Then
  63.           intPage = Int(rsForums.PageCount)
  64.      End If
  65.  
  66.      rsForums.AbsolutePage = CInt(intPage)
  67.      for i=1 to rsForums.PageSize
  68.      if not rsForums.EOF then
  69. %>
  70.  
  71.  
  72. <TR>
  73.           <TD height="16" align="left" valign="middle">
  74.             <a href="messages.asp?iMsg_id=<%=(rsForums.Fields.Item("MSG_ID").Value)%>&iCat_id=<%=(rsForums.Fields.Item("CAT_ID").Value)%>"><%=(rsForums.Fields.Item("MSG_SUBJECT").Value)%></a></TD>
  75.           <TD height="16" align="left" valign="middle"><%=(rsForums.Fields.Item("DATE_POSTED").Value)%></TD>
  76.           <TD height="16" align="center" valign="middle"><%=(rsForums.Fields.Item("REP_COUNT").Value)%></TD>
  77.           <TD height="16" align="right" valign="middle"><%=(rsForums.Fields.Item("MSG_LAST_POST").Value)%></TD>
  78. </TR>
  79.  
  80. <%
  81.  rsForums.MoveNext
  82.      end if
  83.      next
  84.  
  85.      Dim strPage
  86.      strPage = Request.ServerVariables("SCRIPT_NAME")
  87.  
  88.  
  89.           %>
  90.           <tr>
  91.           <td colspan="9">
  92.            <%
  93.           For i = 1 To rsForums.PageCount
  94.           if cint(i)=1 then
  95.           Response.Write("Page: ")
  96.           end if
  97.           If cint(i) <> cint(intPage) Then 
  98.           Response.Write("<a href=""" & strPage & _
  99.                "?page=" & i & "&iCat_id=" & intCat_Id & """>" & i & "</a> ")
  100.           Else
  101.           Response.Write("[" & i & "] ")
  102.           End if
  103.      Next%>
  104.      
  105.          </td>
  106.           </tr>
  107. <%Else%>
  108.  
  109.  
  110.   <tr>
  111.           <td colspan="9">
  112.       There is no records in database !!!
  113.       </td>
  114.           </tr>
  115.      <%
  116. End If
  117.  
  118. rsForums.Close
  119. SET rsForums=NOTHING
  120.  
  121. %>
  122.  
  123. </table>
  124.  
  125.  
  126. <tr>
  127.    
  128.          <td  colspan="4" align=right>
  129.          Powered by
  130.          <a href="#"><img src="CAForum/images/calogo.gif" border=0 ></a>
  131.          </td>
  132.          </tr>
  133. </table>
------------------------------------------------------------------------------------------------------------------------
please help me out.

Last edited by Nico; 10-17-09 at 06:18 AM.
Reply With Quote