So basically I'm trying to make my php script update a few of the values in a db table but for some reason it isn't actually updating. It gives me the success message but I guess that just confirms that the code executed and not that it found a row that matched the WHERE statement to insert the data. to test it I've been using HttpRequester with values set as id = 5, weight = 100, reps = 5 and sets = 5 and as a POST request. There is definitely a row in the table where id = 5 which is what my WHERE statement asks for. Here is the php:
<?php
 if($_SERVER['REQUEST_METHOD']=='POST'){
 $id = $_POST['id'];
 $weight = $_POST['weight'];
 $reps = $_POST['reps'];
 $sets = $_POST['sets'];
 require_once('dbConnect.php');
 $sql = "UPDATE strength_exercises SET previous_weight = '$weight', previous_reps = '$reps', previous_sets = '$sets' WHERE exercise_id = '$id'";
 if(mysqli_query($con,$sql)){
  echo 'Previous weight, sets and reps updated';
 }else{
  echo 'Could not update exercise stats';
 }
 mysqli_close($con);
}
The tables columns are:
exercise_id int(11)
user_id int(11)
exercise_name varchar(100)
previous_weight int(11)
previous_reps int(11)
previous_sets int(11)
When I just execute the following query on the database (which uses the same values as my test should be using) it works fine:
UPDATE strength_exercises SET previous_weight = 100, previous_reps = 5, previous_sets = 5 WHERE exercise_id = 5
Any ideas on what to try would be great
 
    