Re: Linux/PHP/Access Database - oh boy :(

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 2004-05-12 14:11, Alex Gemmell wrote:
>Also, I heard that converting the .mdb file to a .dbf file might help ? but how do I connect to that with PHP?  The PHP manual says this about dbase functions:
>?These functions allow you to access records stored in dBase-format (dbf) databases. There is no support for indexes or memo fields.?
>That?s no good because I have long text fields in the Access database that are of type ?memo?!
>The Manual also says ?we recommend that you do not use dBase files as your production database? ? eek!  It?s only a small database (one table with about 50 records, each with no more than 20 fields) so hopefully it will suffice.

What it basically says is that you shouldn't use
.dbf formats to operate a database with, but only
to transfer (import) data.

I prefer however to use the comma separated value's
(.csv) format that most database programma's can export
and import:

Jaap,van Ganswijk,"this is comment, which contains a comma"

I prefer it because it's human and inter architecture
readable.

In PHP you can read it quite easily using the getscsv()
function, like:

if ($hf=fopen(..)) {
  while ($E=getscsv($hf)) {
    $A[]=$E;
  }
}

For setting up a simple database, why not just read the whole
file each time? You could also look into the adb() funtions,
with gndb() as one of it's prominent members. That way you
will have indexes within your database and can read single
entries.

Another way is to use the serialize() and unserialize()
functions to store complex (PHP-style) datastructures
within a file or within the datafield of an adb() database.

Check out phpinfo() on your hoster's system to see what is
available.

Greetings,
Jaap

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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux