#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2007
    Posts
    4
    Rep Power
    0

    sql


    Yeah that was the issue thanks

    Also now have another issue the sql returns the correct amount of rows when I run the sql thru the db but in the code it produces various errors Variable ... is underfined.. Mostly threadid and conferenceid. Dont see why as the sql statement only needs one variable to be passed..

    <cffunction name="getLatestThreads" access="public" returnType="query" output="false"
    hint="Retrieve the last 20 posts to any threads in forums in this forum.">
    <cfargument name="forumid" type="uuid" required="true">
    <cfset var qLatestThreads = "">

    <cfquery name="qLatestThreads" datasource="#variables.dsn#">

    SELECT #variables.tableprefix#messages.title,
    #variables.tableprefix#messages.posted,
    #variables.tableprefix#threads.name,
    #variables.tableprefix#users.username,
    #variables.tableprefix#messages.threadidfk,
    #variables.tableprefix#messages.body,
    #variables.tableprefix#threads.forumidfk,
    #variables.tableprefix#forums.conferenceidfk
    FROM #variables.tableprefix#messages,
    #variables.tableprefix#threads,
    #variables.tableprefix#users,
    #variables.tableprefix#forums,
    #variables.tableprefix#conferences
    WHERE ( #variables.tableprefix#forums.conferenceidfk = #variables.tableprefix#conferences.id ) and
    ( #variables.tableprefix#threads.id = #variables.tableprefix#messages.threadidfk ) and
    ( #variables.tableprefix#users.id = #variables.tableprefix#messages.useridfk ) and
    ( #variables.tableprefix#forums.id = #variables.tableprefix#threads.forumidfk ) and
    ( #variables.tableprefix#threads.forumidfk = <cfqueryparam value="#arguments.forumid#" cfsqltype="CF_SQL_VARCHAR" maxlength="35"> )

    </cfquery>

    <cfreturn qLatestThreads>
    </cffunction>
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,273
    Rep Power
    968
    What is the actual error? WHICH variable is undefined? There is no #threadid# or #conferenceid# in this code.

    Also, I split this into a new thread. In the future, if you have a new question unrelated to the original thread, please create a new thread. Thanks.
    Last edited by kiteless; September 24th, 2012 at 12:27 AM.

IMN logo majestic logo threadwatch logo seochat tools logo