/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, CreateExerciseRequest $request) { if (!isMakerOfExercise($id, Auth::id())) { flash()->error("You must be logged in as the maker of this exercise."); return redirect('exercises/' . $id); } $input = $request->all(); $exercise = new Exercise(); $exercise->question = $input['question']; $exercise->tips = $input['tips']; $exercise->start_code = $input['start_code']; $exercise->expected_result = $input['expected_result']; $exercise->language = $input['language']; $exercise->id = $id; updateExercise($exercise); flash()->success('Your exercise has been successfully updated.'); return redirect('exercises/' . $id); }
function inputWeights($name, $sets, $reps, $weight, $calories) { //Connect to mySQL $con = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error()); //Connect to Database $db = mysql_select_db(DB_NAME, $con) or die("Failed to connect to MySQL: " . mysql_error()); session_start(); //Get the current workout ID. $WID = getWID(); //Insert data into the cardio table. $sql = "INSERT INTO RESISTANCE" . "(NAME,SETS,REPS,WEIGHT,WID,CALORIES,RID) " . "VALUES ('" . $name . "','" . $sets . "','" . $reps . "','" . $weight . "','" . $WID . "', '" . $calories . "','')"; $retval = mysql_query($sql, $con); //ERROR if (!$retval) { print mysql_error(); } //Update the workout table. updateExercise($calories, $WID); }