Reply to Re: file vs database. mini chat script

Your name:

Reply:


Posted by Jerry Stuckle on 04/18/06 07:13

julian_m wrote:
> I'm just beggining to write some simple-small script which is gonna
> work as a mini chat.
> First aproach:
>
> File: comments.xml
>
> every time this file is accessed, I delete the first line (if number of
> lines is > than x) and add one to the end :
>
> <com>hello</com>
> <com>hello, how are you</com>
> <com>fine, thanks</com>
>
> In client side, I just load this xml inside a div every "n" seconds,
> using ajax
>
> I'm wondering what's going to happen if two or more users try to acces
> to the file at the same time, beacause I don't want to lock the file at
> all...
>
> Is it to use a database a better option? I choice the file option
> beacause I thought that speed would be better.
>
> What would you do?
>

You could corrupt the file.

Either lock the file while you're updating it, or use a database.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация