Page 3 of 3
Re: PHP Tips and Tricks
Posted: Thu Jul 09, 2009 12:36 pm
by mrmajic
another thing .. i have a logins table .. and its set to 15 .. and everything i run this line:
$updateplayer="update players set logins=$logins-1 where name='$player'";
it minus's 1 login from the table ,.. what am i doing wrong .. it doesnt work... should this line work?
Re: PHP Tips and Tricks
Posted: Thu Jul 09, 2009 3:45 pm
by hallsofvallhalla
logins is not a variable, take out the $
$updateplayer="update players set logins=logins-1 where name='$player'";
also i am assuming you have the query line on the next line?
Re: PHP Tips and Tricks
Posted: Thu Jul 09, 2009 9:59 pm
by mrmajic
oh yeah . .. the query line .. now it works

first it was forgetting ; and } now its the query line ..
Re: PHP Tips and Tricks
Posted: Thu Jul 09, 2009 11:00 pm
by mrmajic
so whats the cons to using $_SESSION's to hold all ya variables.. ??
Re: PHP Tips and Tricks
Posted: Fri Jul 10, 2009 1:17 am
by Noctrine
They are all in sessions. What happens when someone clears them.
Re: PHP Tips and Tricks
Posted: Fri Jul 10, 2009 1:20 am
by mrmajic
theonly way to clear sessions from the users point is to logout/close brower .. they only have to log back in .. as long as ya updating the database with the current $_SESSION['variable'], then its ok isnt it??
Re: PHP Tips and Tricks
Posted: Fri Jul 10, 2009 12:47 pm
by Noctrine
A session is still a cookie. You can delete individual cookies in the browser quite easily.
Re: PHP Tips and Tricks
Posted: Fri Jul 10, 2009 5:20 pm
by xezero
this is a good read for those trying to squeeze the extra performance out of php:
http://www.phpbench.com/