database - How to deactivate an account in PHP? -


i trying make deactivate account ...when click link want account status updated in database turn 0. every time click link here nothings happens re direct me page code deactivating

<?php     include "../includes/dbcon.php";     if(isset($_get['user_id']))     {         $result = mysql_query("select user_id users user_id = $user_id");          while($row = mysql_fetch_array($result))         {             echo $result;             $status = $row($_get['status']);              if($status == 1)             {                 $status = 0;                 $update = mysql_query("update users set status = $status");                 header("location: admin_manage_account.php");             }             else             {                 echo "already deactivated";             }         }     } ?> 

i don't know problem exactly, why select id based on id?

why don't "update users set status = $status user_id = $user_id" in first place?

in example don't have condition in update statement...

if want "toggle/flip" value can like:

update users set status = not status user_id = $user_id 

this way, true become false, false become true, etc.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -