Click to See Complete Forum and Search --> : Offering Simple Database System


little jim
12-09-2003, 12:03 PM
I am offering a file which has loads of functions in it to help you manage database systems if you don't have Mysql or anything like that. In your script you just have to say include("http://www.jamesleach.net/data.php"); . This will give you acess to loads of different functions you can use. You will need to know about foreach($array as $var) loops and allot about arrays. I will add bits to this thread foreach function.

Your Database has to be in a specific format which is easy to understand an edit. The first line will define all the feilds and each line below is a new entry in the database. It's like a CSV, but with no quote marks and each feild is seperated by a ~ . Each line would look like this:
Felid A~Feild B~Feild C
Every line can be as long as you want and can conatin any other characters, except '\r\n' and '\n'.
If your versin of PHP dosn't allow you to do remote includes, copy the file below and save it as a PHP document.

little jim
12-09-2003, 12:13 PM
The 'all' function gives an array of the entire database (except the first line) in it's raw format. It looks like this:


$array = all("Database location here");


if you then go into a foreach loop and want to do something with the data entry, you need to split the line into another array of each feild:


foreach($array as $value)
{
$feilds=ex($val);
echo($feilds[0]);
}