Re: a better way, code technique?

2009-09-04 Thread Per Jessen
AndrewJames wrote: is there a better way (hopefully simpler) to code this? i want to get the user id of the logged in user to use in my next statement. $q1 = sprintf(SELECT uid FROM users WHERE users.username='$username'); The only improvement I can see is: $q1 = sprintf(SELECT uid

AW: Re: a better way, code technique?

2009-09-04 Thread Majk.Skoric
-Ursprüngliche Nachricht- Von: Per Jessen [mailto:p...@computer.org] Gesendet: Freitag, 4. September 2009 13:05 An: mysql@lists.mysql.com Betreff: Re: a better way, code technique? AndrewJames wrote: is there a better way (hopefully simpler) to code this? i want to get the user id

Re: AW: Re: a better way, code technique?

2009-09-04 Thread AndrewJames
, code technique? -Ursprüngliche Nachricht- Von: Per Jessen [mailto:p...@computer.org] Gesendet: Freitag, 4. September 2009 13:05 An: mysql@lists.mysql.com Betreff: Re: a better way, code technique? AndrewJames wrote: is there a better way (hopefully simpler) to code this? i want to get

AW: AW: Re: a better way, code technique?

2009-09-04 Thread Majk.Skoric
-Ursprüngliche Nachricht- Von: AndrewJames [mailto:andrewhu...@gmail.com] Gesendet: Freitag, 4. September 2009 13:35 An: Skoric, Majk; p...@computer.org; mysql@lists.mysql.com Betreff: Re: AW: Re: a better way, code technique? hahah thank-you, love the responses here. you guys

Re: a better way, code technique?

2009-09-04 Thread Brent Baisley
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

RE: a better way, code technique?

2009-09-04 Thread Gavin Towey
from you in those few functions! =P Regards, Gavin Towey -Original Message- From: Brent Baisley [mailto:brentt...@gmail.com] Sent: Friday, September 04, 2009 6:21 AM To: AndrewJames Cc: mysql@lists.mysql.com Subject: Re: a better way, code technique? You should store the current user id

RE: a better way, code technique?

2009-09-04 Thread Daevid Vincent
+2 -Original Message- From: Brent Baisley [mailto:brentt...@gmail.com] Sent: Friday, September 04, 2009 6:21 AM To: AndrewJames Cc: mysql@lists.mysql.com Subject: Re: a better way, code technique? You should store the current user id in a session variable. Then you don't have