Link to home
Start Free TrialLog in
Avatar of skodama2
skodama2

asked on

How to use result from CFSCRIPT in CFQUERY

Hi,

I have  a script that captures a visitor's IP address, then converts it to a number.  This is so I can then lookup their city/region for personalization purposes on my site.  The site is not live yet, but I'm having an issue with using the returned value from the CFSCRIPT as a variable to query my DB.  Here's what the script looks like:

<CFSET visitorIP = "#CGI.Remote_Addr#">

 <cfscript>
   function Dot2LongIP(visitorIP)
   {
      if(arguments.visitorIP EQ "")
      {
        return 0;
      }
      else
      {
        ips = ListToArray( arguments.visitorIP, "." );
        return( ( 16777216 * ips[1] ) + ( 65536 * ips[2] ) + ( 256 * ips[3] ) + ips[4] );
      }
   }
</cfscript>

I need to use the resulting number to query a table in my DSN.  Right now, I have:

<cfset myIPNumber = #Dot2LongIP#>

But it's not working correctly - the returned value is "cfindex2ecfm1275582484$funcDOT2LONGIP@115e47a".

I only need the 1275582484 number out of that.

Any ideas?

Thanks in advance!

ASKER CERTIFIED SOLUTION
Avatar of SidFishes
SidFishes
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of skodama2
skodama2

ASKER

Thank you!  Pure magic!