On 03/04/2004, at 5:37 AM, Andy B wrote:

is it ok practice to put code like the code to put results from an mysql query into a combo box into an include file and then just include it wherever its needed? the code i can see would have to be used at least 5 times in the same page....

Typically if there's something you want to use/do more than once, you'd either:


a) include it from it's own file (as suggested), or
b) declare it as a function, and then group the functions into logical include files for certain parts of the website


If you had this one-off problem, then you'd just include it PHP code inline where needed:

<? include("inc/combobox.php"); ?>

If you had 4 or 5 date & time functions you used site-wide, I'd declare them each as functions, then group those date and time functions into a single include file (eg datetime.php), include it at the top of each page (or where needed), and call the functions as needed.

---
Justin French
http://indent.com.au

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to