On Fri, Jul 20, 2001 at 11:52:36AM +0000, Er Galvão Abbott wrote:
> Just a sugestion here, that may sound strange, but I'd do it like
> this:
> 
> Why don't you keep a simle text-counter file for each user? Why this
> HAVE to go trough SQL?

i suppose i want it to go through SQL because I am storing all my
documents and the guts of the site in a database. 


> Just creat a text file with "0" on it. When the user posts, retrieve
> the number from the file, increment it and then write it back...

hmmm, interesting idea, but what happens when there are multiple users,
each one will then have their own file, i know it wont take up too much
disk space, but i really have a thing for tidy directorys:) and this
sounds like a nightmare to me ;)

> 
> This way you don't overload SQL and keep the post counter running...

 could it in fact create more work for the CPU, if it has to keep reading
and writing to files on the disk, as well, would that be any quicker? 



> Tell me what you think, even if you think it's stupid :)

haha, i wouldnt say it's stupid anyway, but i wouldnt be attracted to that
approach, i'm usually drawn to databases, hehe. 

> 
> 
> On Fri, 20 Jul 2001 12:31:15 +0100, [EMAIL PROTECTED] (Conor
> McTernan) wrote:
> 
> >Hey there, 
> >
> >I'm currently writing a web app using php. I was just looking for some
> >advice on one aspect. On this site, users will be able to log in and post
> >messages, or articles, or replies etc, you get the idea. 
> >
> >Anyway, I am storing some info about the users, the usual stuff, name,
> >email, password, all in mysql. I am also storing other info, such as when
> >they last posted, and how many times they have posted. 
> >
> >When a user posts a new message, the message is sent to mysql and stored
> >in a table, at the same time, i also have to increment their total number
> >of posts. The way this is done is by selecting the posts field on their
> >userid, which i have to find using their username, which is set as a
> >session var, when the user logs in. This all results in a good few
> >queries to mysql. 
> >
> >I was wondering would it be better to load all the user info, e.g. number
> >of posts, last post date, into session vars, or should i set a cookie on
> >the client side, or should i just continue with the queries.
> >
> >Any help is appreciated.
> >
> >conor
> 
>        Er Galvão Abbott
>          Webdeveloper
>   [EMAIL PROTECTED]
> ---------------------------------
> To send me an e-mail just remove
> the CAPITAL TEXT.
> ---------------------------------
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to