From: Daevid Vincent Date: September 4 2009 8:11pm Subject: RE: a better way, code technique? List-Archive: http://lists.mysql.com/mysql/218627 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit +2 > -----Original Message----- > From: Brent Baisley [mailto:brenttech@stripped] > Sent: Friday, September 04, 2009 6:21 AM > To: AndrewJames > Cc: mysql@stripped > Subject: Re: a better way, code technique? > > You should store the current user id in a session variable. Then you > don't have to hit the database at all. > > There really is no short way of doing it. Normally you would create a > function (i.e. runQuery) that you pass the query too. Then it handles > running the query, fetching the data, error checking, etc. That way > you don't have to rewrite the same lines every time you want to run a > query. > > Brent Baisley