I need to divide the content from one field in my database(6 paragraphs) in two equal parts of three paragraphs. What would be the best way to that? I thought it was possible in my query but it seems not. Any advise would be more than welcome.
| SitePoint Sponsor |





I need to divide the content from one field in my database(6 paragraphs) in two equal parts of three paragraphs. What would be the best way to that? I thought it was possible in my query but it seems not. Any advise would be more than welcome.
“Good artists copy, great artists steal” (Pablo Picasso - 1934)


it ~is~ possible in the query, but you looked like you were about to run two separate queries, one for the first 3 paragraphs, and another for the rest
and that's wasteful
grab everything in one query, then break it up with coldfusion
in your other thread, you were using CHAR(13,10) as the paragraph marker, so i would try that with ListGetAt
Code:<CFOUTPUT> <p>#ListGetAt(queryname.content,1,CHAR(13,10),FALSE#</p> <!--- 1st paragraph ---> <p>#ListGetAt(queryname.content,2,CHAR(13,10),FALSE#</p> <!--- 2nd paragraph ---> <p>#ListGetAt(queryname.content,3,CHAR(13,10),FALSE#</p> <!--- 3rd paragraph ---> <p> ... other content ... </p> <p>#ListGetAt(queryname.content,4,CHAR(13,10),FALSE#</p> <!--- 4th paragraph ---> <!--- etc. ---> </CFOUTPUT>





Hi Rudy, thank you for the responce. It looks like a good structure I only get the following error:
Invalid CFML construct found on line 14 at column 59.
ColdFusion was looking at the following text:
#
and then:
14 : <p>#ListGetAt(getContent.content,1,CHAR(13,10),FALSE#</p>
15 : <p>#ListGetAt(getContent.content,2,CHAR(13,10),FALSE#</p>
16 : <p>#ListGetAt(getContent.content,3,CHAR(13,10),FALSE#</p>
What could be the reason?
Thank you
“Good artists copy, great artists steal” (Pablo Picasso - 1934)







Stupid, stupid, stupid, that I didn't see thatNow on the other hand I get the error that Variable CHAR is undefined. ?
Sorry for my ignorance, but so far I never had to deal with something like this.
Thank you in advance.
“Good artists copy, great artists steal” (Pablo Picasso - 1934)


you are learning rather quickly that i didn't test my code, eh
(i have an excuse: my computer died last month, i had to buy a new one, and i still haven't gotten around to installing coldfusion again -- i absolutely ~hate~ installs, last time i spent days, literally days, trying to get the damned thing working, declaring the datasource or whatever you have to do to get it to talk to mysql... i am looking forward to that experience again just like you would look forward to having a root canal)
anyhow, replace CHAR(13,10) with CHR(13)&CHR(10)





Hi Rudy this seems to work indeed. Great stuff. I have one last question though. I try to understand the CHR(13)&CHR(10) since within my content I have some lists as well. I though by sticking those in a paragraph I could output them as well but that doesn't seem to work? What should I do to count a list next to the paragraphs?
I know the feeling. I had the same thing last month. What a disaster. You loose so much time(i have an excuse: my computer died last month, i had to buy a new one, and i still haven't gotten around to installing coldfusion again -- i absolutely ~hate~ installs, last time i spent days, literally days, trying to get the damned thing working)![]()
“Good artists copy, great artists steal” (Pablo Picasso - 1934)







Thank you Rudy. I will give this some more thought, before I come back to this. Anyway thank you again.
“Good artists copy, great artists steal” (Pablo Picasso - 1934)
Bookmarks