views:

38

answers:

1

Hello,

I have the following query where I combine two fields from two tables:

    <cfquery name="SearchResult" datasource="MyDSN">
        SELECT CONCAT(titles.TitleName, ', ', platforms.PlatformAbbreviation) AS Result
        FROM
            games
            Inner Join platforms ON games.PlatformID = platforms.PlatformID
            Inner Join titles ON titles.TitleID = games.TitleID
   WHERE
         UCase(titleName) LIKE Ucase('#ARGUMENTS.SearchString#%')
    </cfquery>

<cfreturn ValueList(SearchResult.Result)>

I'm using this code to populate a search field through Ajax. The CONCAT function combines the title name and the platform abbreviation. Running SQL only confirms this. However, once the result comes back through Ajax, only the TitleName comes back. The rest of the string is missing.

For example: I'm expecting "Title Name, Platform" and I only get "Title Name" repeated for as many platforms as there are. What am I doing wrong?

FYI, my table structure is as follows:

platforms(platformID*, platformAbbreviation)
titles(titleID*, titleName)
games(gameID*,platformID*, titleID*)
+2  A: 

Does something need to be escaped before sending it over AJAX? Maybe the commas?

Dan Sorensen
It was indeed the the coma that I used to separate titleName from platformAbbr. Thank you.
Mel
You can define the delimiter used in the ValueList. A good idea if a comma can exist anywhere. A pipe is good, or I like to use CHR(30) since it can't be created from the keyboard.
Al Everett