public function read($id)
 {
     $this->id = (int) $id;
     $this->readStatement->execute();
     $result = $this->readStatement->get_result();
     $pitcher = new PitcherObject();
     while ($row = $result->fetch_object()) {
         $pitcher->setPlayersId($row->players_id);
         $pitcher->setWin($row->win);
         $pitcher->setLoss($row->loss);
         $pitcher->setEra($row->era);
         $pitcher->setInningsPitched($row->innings_pitched);
         $pitcher->setRunsAllowed($row->runs_allowed);
         $pitcher->setEarnedRunsAllowed($row->runs_allowed);
         $pitcher->setWalksAllowed($row->walks_allowed);
         $pitcher->setStrikeOuts($row->strike_outs);
     }
     return $pitcher;
 }
Exemplo n.º 2
0
 * User: Greg
 * Date: 10/12/2015
 * Time: 5:56 PM
 */
include "Database/db.php";
include "Database/Tables/PlayersTable.php";
include "Database/Tables/BatterStatsTable.php";
include "Database/Tables/PollsTable.php";
include "Database/Tables/AdminsTable.php";
include "Database/Tables/EventsTable.php";
include "Database/Tables/PitcherStatsTable.php";
$pitcherTable = new PitcherStatsTable();
$pitcherObject = new PitcherObject();
$pitcherObject->setWin(3);
$pitcherObject->setLoss(2);
$pitcherObject->setInningsPitched(22);
$pitcherObject->setRunsAllowed(12);
$pitcherObject->setEarnedRunsAllowed(10);
$pitcherObject->setWalksAllowed(4);
$pitcherObject->setStrikeOuts(12);
$pitcherObject->calcEra();
$pitcherTable->create($pitcherObject);
/*$eventsTable = new EventsTable();
    $eventsObject = new EventsObject();

    $eventsObject->setName("Bob");
    $eventsObject->setDescription("Bob is a great man and I hope he has a great life.");
    $eventsObject->setImage("ImageGoesHere");
    $eventsObject->setDate("Today");

    $eventsTable->create($eventsObject);