If you want to keep things tidy and fast you can always create a collection of .php files ( such as mod.php, del.php, add.php etc ) for your database functions and then just include() the ones you need when you need them.
Here's an example......
This is the add.php file
Code: Select all
<?php
function add_to_database($table, $name, $email)
{
mysql_query(" INSERT INTO $table VALUES ('$name','$email') ");
}
?>
And this is part if the main page...
Code: Select all
<?php
If(isset($action) && $action=='add')
{
include("add.php");
add_to_database('tablename','bob','bob@home.co.uk');
}
?>
Something like that anyway
Using include() is always good because it means you don't have to load up every single function and/or php code at once, and it normally (if used in the right way) will speed up your page run/load times.