Application messages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
msurabbott
Forum Commoner
Posts: 33
Joined: Thu Jan 01, 2009 10:18 pm
Location: Chicago, IL, USA

Application messages

Post by msurabbott »

All,

How *bad* is it to store application success/failure messages in a db table? Heres what I'm doing..

- Add row(s) to db
- Iterate through the rows using PHP, assign each to an array in Smarty
- Truncate the table
- Display the messages in my Smarty template

There is the possibility of a message not being able to write to the db, then there is nothing to report the error, but using Smarty, and header() sometimes to redirect a user from script to script, i can't think of a better way.

The smarty community cannot seem to do so either..
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Re: Application messages

Post by miro_igov »

Not good to save errors in db that way. How you manage the sessions? If someone raises an error but just in the same time another user opens same file he will see the error of the other and the original user to whom is the error will not see it because it is truncated :roll:

You can use sessions instead.
msurabbott
Forum Commoner
Posts: 33
Joined: Thu Jan 01, 2009 10:18 pm
Location: Chicago, IL, USA

Re: Application messages

Post by msurabbott »

but i cannot clear the session from my smarty template.. nor can i access the session from inside classes (i create errors from the class in the class file)
Post Reply