Page 1 of 1

Database alternative

Posted: Thu May 12, 2005 5:45 pm
by jaymoore_299
(First time PHP programmer)

I have used MySQL before, but whenever there are some server problems, any access to the data causes the page to have upwards to 6 seconds before it starts to load. When I took out the line that accessed the database, the page loaded instantly.

I don't really require a very big database, just enough to hold, at maximum, probably a couple paragraph's worth of data. I mainly just want to record daily visitor and traffic out stats in one file, then archive that into a larger file that holds 30 days worth of such data.

Should I just use a text file for this? Any other alternatives?

How do I go about making a secure database file that cannot be accessed by anyone but me?

Posted: Thu May 12, 2005 6:40 pm
by php_wiz_kid
Are you storing entire pictures in the database? It shouldn't take long to access text, especially from a MySQL database.

Posted: Thu May 12, 2005 7:09 pm
by Burrito
sounds to me like you had something configured wrong with MySQL. when you ran queries from the command line interface of MySQL, was it still slow?

If I were you, I'd keep trouble shooting that front as MySQL is going to be your best solution big or small.

Posted: Thu May 12, 2005 7:26 pm
by php_wiz_kid
If you are storing entire pictures in the database then stop! Instead of storing pictures just store the document path to the folder in the database instead of the actual picture.

Posted: Thu May 12, 2005 10:27 pm
by jaymoore_299
No, I'm not storing pictures. I did not configure the MySql myself. I was just having some problems with it in the past, now it seems to work fine, but I was thinking of using a text based database because of those incidents. If there is a way to secure a text based file, then I'd prefer that.

Posted: Thu May 12, 2005 10:57 pm
by php_wiz_kid
Some people use XML as a database file. I wouldn't recommend it and I don't know of a way to make it secure since they could look at it if they knew the url to the text/XML file. Maybe you could do something with .htaccess/.htpaswd if you're using Apache. I don't know how though.

Posted: Fri May 13, 2005 1:35 am
by Chris Corbyn
You can achieve some pretty rough and ready results by just using delimitted text files and a small amount a regex (or a large amount of explode() etc). I used to do this in the days before I actually bothered to learn MySQL :P

Code: Select all

#somesection
field1 ::@:: field2 ::@:: field3
field1 ::@:: field2 ::@:: field3
field1 ::@:: field2 ::@:: field3
field1 ::@:: field2 ::@:: field3
#end_somesection

#anothersection
field1 ::@:: field2
field1 ::@:: field2
#end_anothersection
Providing you're comfortable with the filesystem functions fopen() fread(), fwrite() etc and you carefully consider an appropriate delimter to use then for small amounts of data you should be ok.

I actually ran a website with over 3000 ringtones using a system like this as a noob (oh dear :oops: ).

Posted: Fri May 13, 2005 1:40 am
by php_wiz_kid
In college I had to develop VB .NET apps using a comma seperated approach. It was truly a pain. Use MySQL if you can :wink: