For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > January 2005 > converting sql db to plaintext db









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author converting sql db to plaintext db
Fabian

2005-01-31, 3:57 pm

How can I convert a php script that uses an sql database so that it can
use a simple text file (or multiple text files, but NOT sql) instead?


--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Erwin Moller

2005-01-31, 3:57 pm

Fabian wrote:

> How can I convert a php script that uses an sql database so that it can
> use a simple text file (or multiple text files, but NOT sql) instead?
>
>


Not easy Fabian.

You'll have to rewrite everything.

I think you better consider using a flatfile-database system.
Yes they exist.
You can use SQL and the 'database' will be a PHP script that opens the
tablefiles.

This is a good one:

http://www.c-worker.ch/txtdbapi/index_eng.php

Regards,
Erwin Moller
Erwin Moller

2005-01-31, 3:57 pm

Erwin Moller wrote:

(From the manual for those who care)

What is the "PHP-TextDB API" ?

If you wanted to make a dynamic PHP-Website you've had two choices:

1. You could save your data in a self-defined formatted text files. This has
one big
divantage: You would have none of the advantages a SQL database would
provide,
such as performing common SQL commands as SELECT, INSERT, and UPDATE, as
well as filtering or ordering the result of queries. .

2. You could host your website on a webserver that provides database
software, but
web hosting options on such a Server cost additional funds.

That's where the "Txt-Db-API" could help.
With the "Txt-Db-API" you can access normal Text Files like a SQL Database.
You don't need any special database software on the webserver, yet you can
still use SQL!
You can use the API to create, query, change, delete, SQL tables, and you
don't
have to bother with the Text-Files themself; Almost everthing can be done
with
the supported API calls.The Txt-Db-API is object oriented and is very simple
to use (IMHO :)).
Divantages of the Txt-DB-API: It doesn't perform as well as a true
production database system.
R. Rajesh Jeba Anbiah

2005-01-31, 3:57 pm

Fabian wrote:
> How can I convert a php script that uses an sql database so that it

can
> use a simple text file (or multiple text files, but NOT sql) instead?


phpSt.Erwin already gave you the answer. But, FWIW, it is always
better to go for wrapper classes for databases. I'd suggest phpBB like
setup. In that case, it is easy to switch to other DB or to any flat
file DB by just coding the wrapper.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com