PDA

View Full Version : php error handling speed questions


superunison
11-13-2002, 11:53 AM
hey all,
i'm building an error system for a site i'm working on. i've decided to pass errors numerically between pages / sections of pages when needed (for logging purposes, as well as certain logic reasons). i can think of several ways of translating these errors so that they have meaning to the site's users. i can build them into a global array, i could use a database lookup, i could have a flat text file that's looked through, i could have an array built off a text file, etc.
my question is, does anyone have any experience with which of these is the fastest and most versatile? obviously, the db way to do it would allow me the most freedom, but i figure that connecting to the db for the purposes of spitting out what will probably be, most frequently, one error, is inefficient.
i'm leaning towards a numerically indexed global array, stored in an include. any thoughts?
help is appreciated.

chris

Quintopia
11-17-2002, 04:52 PM
It all depends on how much data you plan on storing. If your array gets to 10,000 lines, it's probably better to go with the db, but you can't possibly have that many errors, can you? I would certainly recommend the array, as that method has been tried and proven (many bulletin board systems. . .maybe even vB. . .use this method for both error and language translation)

superunison
11-20-2002, 11:18 AM
yeah, that's what i decided to do. i'm glad to have someone back me up. actually, the whole array is stored inside an error class that i wrote, so it only exists as needed... much smarter than including it in every page. thanks for the advice.