[Solved] Update PHP statement [closed]


you are not connecting to database. you variables are strings.

change this

   $conn = mysql_connect("$DB_HostName", "$DB_User", "$DB_Pass")

to

  $conn = mysql_connect($DB_HostName, $DB_User, $DB_Pass)

and your update is wrong . you have to use math part outside the query, try use this

         $RH = $RANK * $HEALTH ;
         $SP = $Skills + $POWER ;
        $SPRH = $RH + $SP ;
       $Power = $SPRH - $userSPRH ;
       $HitCash = $POWER - $userWORTH ;
        $PR = $POWER * $RANK ;
        $SR = $Skills * $RANK ;
       $SPRR = $SR + $PR ;


 $sql = " UPDATE UserProfile SET 

       Health = Health - $POWER ,
       Worth = $SPRR * $HEALTH ,
       Cash = Cash - $HitCash
       WHERE userID = $userID  ";

5

solved Update PHP statement [closed]