mysql - run update query only once in php -


is possible run update query once, here have link or button if clicked profile changed(updated) automatic , brought him @ myaccount.php page . thing going fine , working main problem occuring when reloading same page(myaccount.php) , profile updating every time. want profile should change when clicked link or button once...i set link as

<a href='myaccount.php.php?age =$age && status= $status' target='_blank' style='color:#e07707;font-weight:bold;'>update profile</a></div></div><br> 

and set update query on myaccount.php as:

  if(($age== '') || ($location= '') || ($status= ''))      {         $newquery1 = "update $tabl_u something...................... id='$id'";     } 

there no submit button no other events update data, clicked url or link passed id update data, hope question done side , hope understand if missed or missing please let me know ...feel free ask regarding question..plz realy need help....thanks in advance !

you should never data change in request. said in html 4 , http specifications

if processing of form idempotent (i.e. has no lasting observable effect on state of world), form method should get. many database searches have no visible side-effects , make ideal applications of query forms.

if service associated processing of form has side effects (for example, modification of database or subscription service), method should post.

for example, happens if user has "web accelerator" pre loads urls on page ?

you should check request indeed come user on website, or open door easy csrf vulnerability.

with said, usual method fix want that, after updating user status in database, should issue redirect non-modifying page.

base page -> click on change link -> change status in database , redirect base page again

<?php if(($age== '') || ($location= '') || ($status= '')) {    mysqli_query(/* update whatever */);    header('location: myaccount.php');    exit; } 

if refresh page, on base page won't change anything. if press "back" in browser, goes page base (pages issues redirect aren't saved in browser history).


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -