Alright, these may be elementary questions, but i'm learning to implement the use of functions. I am attempting to use them in the CMS I've coded for sites I do. My questions are:
1) What is the best practice for storing the functions? Do you keep them in a master file, like functions.php, and include it into the template so they are always available? Or is there some other way i'm missing?
2) Say I want to pass two arguments to the function for a SQL update, do I scrub the submitted data outside the function before the data is submitted? Or inside the function each time it is called?
e.g.
function UpdateSite($section,$text){
$text = mysql_real_escape_string($text);
$text = preg_replace('/\'/', ''', $text);
mysql_query("UPDATE $dbtable SET `texttable` = '$text' WHERE `id` = $section");
}
Thanks for the help.