Hi, i am a flex-Developer (and Air) and playing around with coldfusion... My Problem: I want to read out a Database (MySQL) with Coldfusion - So far, no problem. Now i want to return the results as personal Objects to Flash. Detail: I have a Component wich represents a user <cfcomponent displayname="CurrentUserVO" hint="Represents the logged in User" output="false"> <cfset this.username = "" /> <cfset this.password = "" /> <cfset this.firstname = "" /> <cfset this.lastname = "" /> </cfcomponent> PHP: (In Flex there is a "linked" Class with the same Content) <cfcomponent hint="Exchange" output="false"> <cfobject name="currentuserVO" component="CurrentUserVO"> <!-- cfc property names --> <cffunction name="login" displayname="login" access="remote" output="false" > <cfargument name="username" required="true" type="String"> <cfargument name="password" required="true" type="String"> <cfquery name="Meinquery" datasource="cfagency" username="root" password=""> SELECT * FROM user WHERE username= '#username#' AND password = '#password#' </cfquery> <cfif isDefined("query")> <cfscript> currentuserVO.username = Meinquery.username; currentuserVO.password = Meinquery.password; currentuserVO.firstname = Meinquery.firstname; currentuserVO.lastname = Meinquery.lastname; </cfscript> <cfreturn #currentuserVO# > <cfelse> <cfreturn "false" > </cfif> </cffunction> PHP: That doesn't work... Strange: I can return the whole query and i can reutrn for example "currentuserVO.lastname" But why i can't return currentUserVO ??? Greetings from Germany, nico
Nobody knows? It would be great, if someone can help me. (I can't imagine that this is so complicated?
<cfreturn currentuserVO > Should work just fine. You don't need that # # Note that you should add a return type in the function name.