Looking at a quey from a seperate page

How do you get a query to look at a query on another page, without having to copy that query and paste it in the page your working on

for example: ive the option of sending invoices manually and automatically and I have the image in the action page when I manually send them, without coping and pasting the code I need I want to ba able to reference abck to this, (it will same me having to update the same query twice if it needs to be changed down the line

If you want to take this right back to basics put the query in a separate cfm file and call it into the page(s) your needing it in with <cfinclude />. Then just call it on your other page like it exists with everything else.

That’s a REALLY old way of doing things though (going back to version 5 of CF and below) and isn’t very modular.

If you want to go with “Best Practice” then the query should be placed in a CFC and that called into each of your pages when needed:


The advantages of CFCs if you can modularise your code into “blocks” so it makes it easier to manage as your application grows.

ok thanks for that