OOP | Querying and show updated value in same file

Evilsmoothie

Mad kung-fu artist
Feb 11, 2013
446
57
Hello. The title might be a little confusing, but Ill explain better here:

Every time a user opens a specific page, a query is ran and the updated value is showed. However, because OOP isn't procedural (if I understood this correctly), the query thats updating and pulling data is running at the same time, so the old value is showed on the page. I want to update and display the new value without having to refresh the page.

Not really sure how to go about this. Apologies for my stupidity, but Im new to OOP so trying to figure all this crap out. Would go on stackoverflow, but they are all assholes. Answer is still probably right infront of my face.

The Habbo version:
Every time the user opens the client, I'm updating it's SSO ticket. But since the update and select is ran at the same time, the old ticket is entered into the flashvars so the emulator can't find the user because the ticket it's looking for no longer exists.
 

RastaLulz

fight teh power
Staff member
May 3, 2010
3,926
3,921
I assume your issue is that that you're accessing a value that has already been gathered (via a select query) and stored to a variable before you've gone ahead and ran a query to update the ticket? Obviously the value isn't going to to automagically change in that case. It's hard to specifically solve your issue without seeing how the ticket is being accessed on the client, and whether the solution would be to simply access that value and set it to the new one (when you fire the update query), or to have a method in a class called getTicket(), which would access the newly generated ticket in both the update and on the client, as opposed to querying the old ticket that was probably initialized early in the app's boot.
 
Last edited:

Evilsmoothie

Mad kung-fu artist
Feb 11, 2013
446
57
I assume your issue is that that you're accessing a value that has already been gathered (via a select query) and stored to a variable before you've gone ahead and ran a query to update the ticket? Obviously the value isn't going to to automagically change in that case. It's hard to specifically solve your issue without seeing how the ticket is being access on the client, and whether the solution would be to simply access that value and set it to the new one (when you fire the update query), or to have a method in a class called getTicket(), which would access the newly generated ticket in both the update and on the client, as opposed to querying the old ticket that was probably initialized early in the app's boot.
Your assumption is dead on, and it's dumb how I didn't see the obvious myself. I can solve this. Lol, thanks! :oops:

Edit: Yup.. Very easy. Just added the ticket as it's own variable (using Smarty) after updating it. Solved it.
 
Last edited:

Users who are viewing this thread

Top