Skip to main content
Inspiring
April 22, 2008
Answered

Query stopping after first row

  • April 22, 2008
  • 4 replies
  • 1035 views
I have a query to show people what they have signed up for and it's returning the first row it encounters and then stops.

When I run it in SQL it works fine and returns all rows. What am I missing here?



This topic has been closed for replies.
Correct answer Inkfast
I figured it out. The second query had a *and* operator in the where clause. I changed it to *or*.

Thanks for the help!

4 replies

InkfastAuthorCorrect answer
Inspiring
April 22, 2008
I figured it out. The second query had a *and* operator in the where clause. I changed it to *or*.

Thanks for the help!
Inspiring
April 22, 2008
well, to see what your query is producing in the CFDUMP, it should actually be :

<cfdump var="#regionInfo#">

This will show everything that is produced by the query and tell you if it is pulling the proper rows, just like in the DB.

If it is generating the proper data in the CFDUMP at this point, you output to your users with the <CFOUTPUT query="regionInfo"> tag using the columns that you want to appear inside it.

i.e.
<CFOUTPUT query="regionInfo">
#regionInfo.categoryID#, #regionInfo.regionID#<BR>
</CFOUTPUT>

** I placed a BR tag at the end because if there is more than one row it will run together without any type of separation. Once you know the output is running properly, you can format the output as required.
Inspiring
April 22, 2008
We need to see the output code to determine what may be happening. The query looks OK and pretty simple, so unless there is only one entry in the table that matches both criteria in the query, it would have to be the output causing an issue.

The CFDUMP showing only 1 row would kind of indicate that only 1 entry matches both "attorneyID = 15" AND "active = 1" so double check what you SHOULD be seeing from the database.



InkfastAuthor
Inspiring
April 22, 2008
As noted above, when I run the SQL command on the server it returns all of the rows that have the correct attorneyID and are active. I have even tried removing the active part of the query just to see if that was it.


Inspiring
April 22, 2008
What is telling you that only one row is being returned?
InkfastAuthor
Inspiring
April 22, 2008
Both cfdump and cfoutput are giving the first row of the table and nothing more. Am I outputting the data wrong?