anzahl der sets einer übung
This commit is contained in:
parent
8e28e5008c
commit
d5b4d8be42
@ -3,24 +3,26 @@
|
||||
|
||||
class Exercise
|
||||
{
|
||||
public $id, $name, $description, $amount, $type, $unit, $current;
|
||||
public $id, $name, $description, $amount, $sets, $type, $unit, $current;
|
||||
|
||||
/**
|
||||
* Workout constructor.
|
||||
* Exercise constructor.
|
||||
* @param $id
|
||||
* @param $name
|
||||
* @param $description
|
||||
* @param $amount
|
||||
* @param $sets
|
||||
* @param $type
|
||||
* @param $unit
|
||||
* @param $current
|
||||
*/
|
||||
public function __construct($id, $name, $description, $amount, $type, $unit, $current = 0)
|
||||
public function __construct($id, $name, $description, $amount, $sets, $type, $unit, $current = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->name = $name;
|
||||
$this->description = $description;
|
||||
$this->amount = $amount;
|
||||
$this->sets = $sets;
|
||||
$this->type = $type;
|
||||
$this->unit = $unit;
|
||||
$this->current = $current;
|
||||
|
@ -13,7 +13,7 @@ if (isset($_GET['token'])){
|
||||
$userID = $userData[0]['user'];
|
||||
|
||||
if(isset($_GET['workout'])){
|
||||
$sql = "SELECT exercises_in_workout.id, name, description, amount, type, unit FROM exercises_in_workout inner join workout_types on workout_types.id=exercises_in_workout.workout_type inner JOIN workout_type_measurements on workout_type_measurements.id=workout_types.measurement where exercises_in_workout.workout_routine=? order by exercises_in_workout.id asc ";
|
||||
$sql = "SELECT exercises_in_workout.id, name, description, amount, sets, type, unit FROM exercises_in_workout inner join workout_types on workout_types.id=exercises_in_workout.workout_type inner JOIN workout_type_measurements on workout_type_measurements.id=workout_types.measurement where exercises_in_workout.workout_routine=? order by exercises_in_workout.id asc ";
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->bindParam(1, $_GET['workout']);
|
||||
if ($stmt->execute()){
|
||||
@ -21,7 +21,7 @@ if (isset($_GET['token'])){
|
||||
$returnExercises = array();
|
||||
foreach($exercises as $exercise){
|
||||
|
||||
$returnExercises[] = new Exercise($exercise['id'], $exercise['name'], $exercise['description'], $exercise['amount'], $exercise['type'], $exercise['unit']);
|
||||
$returnExercises[] = new Exercise($exercise['id'], $exercise['name'], $exercise['description'], $exercise['amount'], $exercise['sets'], $exercise['type'], $exercise['unit']);
|
||||
}
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($returnExercises);
|
||||
|
Loading…
Reference in New Issue
Block a user