PHP
HEllo world, i need some help here plz.
i want to make an addressbook and want to have an index file that
includes/requires all the other files in the include folder(the include folder contains all the functionality) so that i dont have to manually include files in other files.
The code is an example, of what i want i to be like, for instance
db_access.include.php includes db_connect.include.php which i dont want... i just want somehow to include db_connect.include.php in the index file and have it accessible every where.
sorry for my english..
regards
db_connect.include.php is given below
<?php
$server="localhost";
$user="root";
$pass="";
global $connection;
$connection = mysql_pconnect($server,$user,$pass) or die("Error connecting to the server");
$database = "addressbook";
mysql_select_db($database) or die("No such database exists");
print("Connected to the database");
print("<br />");
?>
db_access.include.php is given below
<?php
include '/include/db_connect.include.php';
function insert($data,$table, $connection){
$query="insert into $table ('name','phone','email','website','notes') values('$data[name]','$data[phone]','$data[email]','$data[websites]','$data[notes]')";
var_dump("Inside db_access.include.php" . $connection);
if (!mysql_query($query,$connection))
{
die('Error: ' . mysql_error());
}
print('1 record added');
}
?>