php - How can my session update new changes every time my website is open? -


description:

in website, there cash amounts every person account.

by press of button, amount of money subtracts or adds cash amount.

problem:

this change shows in database (phpmyadmin), when write cash amount on site, still shows old amount. amount updates when user logs out , in. want amount automatically update when page open.

question:

is there line of code can add php @ top of page after session_start(); , such session_update(); (i know doesn't exist, it's example) or check changes? or have complicated several lines of code? want without making person log out.

thanks helping! (i'm kind of noob @ :) )

let's have session variable of $_session['cash_amount'] , equal $100. if $10 gets subtracted, in code, $_session['cash_amount'] -= 10; , subtract session variable next time user sees page, have correct amount. of course you're pulling database , if that's case, want session variable equal result of query you're pulling from.

and if want without refreshing page, you'll use ajax , pull amount in way that's whole different ball of wax might not prepared yet.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -