MySQL and Processing help, with $_SESSION
in
Programming Questions
•
3 years ago
Hey all i'm trying to create an app that will work when the user is logged in on my site and the session is started but im not sure what the syntax is for it in processing, at present the code runs when you boot from the local machine but I get class not found errors when I try to run it on the site, so I can't actually test it. Any ideas would be gratefully appreciated.
Thanks, Harrison
here is the problem block:
code:
- if ( dbconnection.connect() )
- {
- // now read it back out
- //
- dbconnection.query( "SELECT score FROM players WHERE player_name = '{$_SESSION['player_name]'}" );
- while (dbconnection.next())
- {
- dbscore = dbconnection.getInt("score");
- if(dbscore < score)// if the db score is lower than the new we update it.
- {
- dbconnection.execute(" UPDATE players SET score ='"+score+"' WHERE player_name = '{$_SESSION['player_name]'}");
- }
- }
- }
- else
- {
- // connection failed !
- }
- }
- }
1