Skip navigation
Currently Being Moderated

Table doesn't exist

Feb 2, 2013 8:29 AM

I'm working on this page and I can't figure out why I keep getting the error:

 

Error Executing Database Query.

General error: Table 'mymindsnotrighttest.notifylist' doesn't exist

 

 

The thing is, the page loads on my testing server but not when I put it online.  (On the testing server, the cfmail isn't functional but I know it's not supposed to be).  I'm aware I have the 'notifylist' cfquery twice, but it doesn't work when it's just one or the other.

 

this is some of the code I've been working with.  Any help would be very much appreciated.  Thanks. - Mike

====================================================================== ====================

 

<cfset CurrentPage=GetFileFromPath(GetBaseTemplatePath())>

 

<cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1">

  <cfquery datasource="mymindsnotrighttest" password="Mex0Wix0" username="mikewycklendt">  

    INSERT INTO boardtopics (post_id, board_id, user_id, username, title, content, date)

VALUES (<cfif IsDefined("FORM.post_id") AND #FORM.post_id# NEQ "">

<cfqueryparam value="#FORM.post_id#" cfsqltype="cf_sql_numeric">

<cfelse>

NULL

</cfif>

, <cfif IsDefined("FORM.board_id") AND #FORM.board_id# NEQ "">

<cfqueryparam value="#FORM.board_id#" cfsqltype="cf_sql_numeric">

<cfelse>

NULL

</cfif>

, <cfif IsDefined("FORM.user_id") AND #FORM.user_id# NEQ "">

<cfqueryparam value="#FORM.user_id#" cfsqltype="cf_sql_numeric">

<cfelse>

NULL

</cfif>

, <cfif IsDefined("FORM.username") AND #FORM.username# NEQ "">

<cfqueryparam value="#FORM.username#" cfsqltype="cf_sql_clob" maxlength="65535">

<cfelse>

''

</cfif>

, <cfif IsDefined("FORM.title") AND #FORM.title# NEQ "">

<cfqueryparam value="#FORM.title#" cfsqltype="cf_sql_clob" maxlength="65535">

<cfelse>

''

</cfif>

, <cfif IsDefined("FORM.content") AND #FORM.content# NEQ "">

<cfqueryparam value="#FORM.content#" cfsqltype="cf_sql_clob" maxlength="2147483647">

<cfelse>

''

</cfif>

, <cfif IsDefined("FORM.date") AND #FORM.date# NEQ "">

<cfqueryparam value="#FORM.date#" cfsqltype="cf_sql_timestamp">

<cfelse>

NULL

</cfif>

)

 

 

<cfquery name="rsNotifyList" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

SELECT *

FROM notifylist

</cfquery>

 

 

<cfmail

        TO="<cfoutput query=rsNotifyList>#rsNotifyList.email#, </cfoutput>"

        from="MyMindsNotRight@mymindsnotright.com"

        subject="New Post Just For Me"

        server="scriptmail.intermedia.net" 

        >

#FORM.username# has made a new post:

==================================================

#FORM.title#

--------------------------------------------------

#FORM.content#

-------------------------------------------------

 

 

You can see the full discussion by clicking this link:

http://www.mymindsnotright.com/discussionGenReplies.cfm?post_id=#FORM. post_id#

 

  </cfmail>

 

 

 

 

  </cfquery>

  <cflocation url="discussionGenReplies.cfm?post_id=#post_id#">

</cfif>

<cfquery name="Recordset1" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

SELECT *

FROM boardtopics

WHERE board_id = 1

ORDER BY post_id DESC

</cfquery>

<cfquery name="rsRepliesNumber" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

SELECT *

FROM board_replies

WHERE board_id = 1

</cfquery>

<cfquery name="rsTopicRecordCount" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

SELECT *

FROM boardtopics

</cfquery>

<cfquery name="rsNotifyList" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

SELECT *

FROM notifylist

</cfquery>

 
Replies
  • Currently Being Moderated
    Feb 2, 2013 9:19 AM   in reply to wycks

    In your actual code, do you really have a <cfquery> inside another <cfquery>, or was that a pasting accident?

     

    Also, as a side note, those four last queries could probably be combined into one, using JOINs.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 2, 2013 10:37 AM   in reply to wycks

    Your "INSERT INTO boardtopics" query tag (which has no name="" attribute) is still open when you start your "<cfquery name="rsNotifyList" query, and doesn't close until after the </cfmail> close.  AFAIK, nesting cfquery tags is not allowed.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 2, 2013 10:56 AM   in reply to wycks

    Can you do a <cfdump var="#rsNotifyList#"> and see what it gives you?  Stick it after the close of the "INSERT INTO boardtopics" query (which you should really give a name to) and the beginning of your <cfmail> tag.

     

    Also, the second code example shows the <cfmail inside the close </cfquery> so make sure to close the query tag before the mail tag starts.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 2, 2013 11:13 AM   in reply to wycks

    Just to be clear, is the error message still about the <cfoutput> tag, or the <cfdump> tag?

     

    Also, you don't need to prefix your <cfoutput> variable with a query name when you're using query="" inside the cfoutput, unless you're pulling a variable from a query other than the one specified in the query="" attrib.  You can just use <cfoutput query=rsNotifyList>#email#, </cfoutput>, although I'd probably build my list of recipients outside of the <cfmail> tag, because I think you're going to get an extra comma on the end the way you're doing it, and I don't know if that'll throw an error or not.

     

    Also, I think you can do <cfmail query="" and use #email# in the TO="" attrib.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 2, 2013 11:18 AM   in reply to wycks

    Yeah.  Change your cfmail tag to this:

    <cfmail

            query="rsNotifyList"

            to="#rsNotifyList.email#"

            from="MyMindsNotRight@mymindsnotright.com"

            subject="New Post Just For Me"

            server="scriptmail.intermedia.net" 

            >

    ...

     

    Give your second query (the INSERT one) a name="" because that's listed as required.

     

    Let's see if you get the same error.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 2, 2013 11:31 AM   in reply to wycks

    Odd, since there's no longer a <cfoutput> on that page.

     

    Move the cfdump up to just below the "rsNotifyList" query and see if you get results from it.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 2, 2013 11:43 AM   in reply to wycks

    Do you get a line number for the <cfoutput> error?  I don't think the error is coming from that form.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 2, 2013 12:20 PM   in reply to wycks

    In your HTML table, comment out this line with a CF comment (<!--- ):

    <cfoutput query="rsNotifyList">#rsNotifyList.email#, </cfoutput>

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 2, 2013 12:33 PM   in reply to wycks

    The page could do with some restructuring and simplifying. Its structure is essentially as follows:

     

    <cfset CurrentPage=GetFileFromPath(GetBaseTemplatePath())>

     

    <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1">

     

        <cfquery name="rsNotifyList" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

        </cfquery>

        

        <cfdump var="#rsNotifyList#">

       

        <cfquery datasource="mymindsnotrighttest" password="Mex0Wix0" username="mikewycklendt"> 

        </cfquery>

        

        <cfmail>

        </cfmail>

       

        <cflocation url="discussionGenReplies.cfm?post_id=#post_id#">

    </cfif>

     

    <cfquery name="Recordset1" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

    </cfquery>

    <cfquery name="rsRepliesNumber" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

    </cfquery>

    <cfquery name="rsTopicRecordCount" datasource="mymindsnotrighttest" username="mikewycklendt" password="Mex0Wix0">

    </cfquery>

     

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <html>

    </html>

     

    This immediately reveals at least one issue. The cfdump is redundant. If the if-condition is satisfied, the page will redirect to discussionGenReplies.cfm, and no dump will be displayed.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 2, 2013 12:35 PM   in reply to BKBK

    I guess I should probably not assume that people comment out redirects when testing.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points