Skip to main content
Participant
March 19, 2009
Question

Session variables passing to functions

  • March 19, 2009
  • 2 replies
  • 307 views
I am trying to create a page that adds property listings and then add features to the properties.

i attached the code for the page that is having issues. I have session variables turned on and here is the function and i cannot get the last listing_id in the listing table to be sent.

I have a function to find the last listingID but the addlistingfeature doesnt like the return type





<cffunction name="AddListingFeature" returntype="void">

<cfargument name="Feature_ID" type="string" required="true">
<cfargument name="Listing_ID" type="string" required="true">

<cfquery datasource="#request.realestatedata#">
Insert Into ListingsFeatures_T(Listing_ID,Feature_ID)
Values('#Trim(arguments.Listing_ID)#','#Trim (arguments.Feature_ID)#')
</cfquery>

</cffunction>
    This topic has been closed for replies.

    2 replies

    Inspiring
    March 22, 2009
    You are better off looking for the id value inside your function. It may have changed since the user loaded the calling template into their browser.
    March 21, 2009
    Hi,

    Your code is showing that you're passing the Listing_ID as though the code "knows" what it is. If you don't have it in the code, you need to query the db and obtain it. If it is the last record, something like SELECT max(Listing_ID), or if this is a new row, is it something like the max(Listing_ID) + 1.

    cfwild