Calling a method or piece of code from another file

WEWFAGTEABS

New Member
A have a very large piece of code that I execute multiple times on my webpage, with only a slight difference each time (it uses information from a database. Sometimes it's within a foreach loop, using "row.nameofrow", and other times it's just a single record, using "query.nameofrow").I'm pretty new to coding, and I'm wondering if there's a way to place that large selection of code into another file and call it each instance I use it (possibly using a parameter for whether it uses "row" or "query") instead of writing out the entire block of code each time. What kind of file would I need to use, and how would I call it?
 
Back
Top