/ Published in: PHP
Creates table structure for pitchfx data that is provided by mlb.com. Open PHP file and enter username and password for localhost. Feel free to customize to suit your preference.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $uname = ''; $pswrd = ''; if (!$con) { } $db = "CREATE DATABASE IF NOT EXISTS pitchfx"; $sql = "CREATE TABLE IF NOT EXISTS `pitches` ( `inning` tinyint(4) NOT NULL, `date_id` varchar(30) NOT NULL, `top_bot` tinyint(1) NOT NULL, `away` varchar(3) NOT NULL, `home` varchar(3) NOT NULL, `pitch_id` mediumint(8) unsigned NOT NULL, `pitch_hand` varchar(1) NOT NULL, `ab_id` mediumint(8) unsigned NOT NULL, `ab_hand` varchar(1) NOT NULL, `des` varchar(55) NOT NULL, `type` varchar(1) NOT NULL, `id` smallint(5) unsigned NOT NULL, `x` float unsigned NOT NULL, `y` float unsigned NOT NULL, `start_speed` float unsigned DEFAULT NULL, `end_speed` float unsigned DEFAULT NULL, `sz_top` float unsigned DEFAULT NULL, `sz_bot` float unsigned DEFAULT NULL, `pfx_x` float DEFAULT NULL, `pfx_z` float DEFAULT NULL, `px` float DEFAULT NULL, `pz` float DEFAULT NULL, `x0` float DEFAULT NULL, `y0` float DEFAULT NULL, `z0` float DEFAULT NULL, `vx0` float DEFAULT NULL, `vy0` float DEFAULT NULL, `vz0` float DEFAULT NULL, `ax` float DEFAULT NULL, `ay` float DEFAULT NULL, `az` float DEFAULT NULL, `break_y` float DEFAULT NULL, `break_angle` float DEFAULT NULL, `break_length` float DEFAULT NULL, `ball` tinyint(3) unsigned DEFAULT NULL, `strike` tinyint(3) unsigned DEFAULT NULL, `on_1b` mediumint(8) unsigned DEFAULT NULL, `on_2b` mediumint(8) unsigned DEFAULT NULL, `on_3b` mediumint(8) unsigned DEFAULT NULL, `sv_id` varchar(13) DEFAULT NULL, `pitch_type` varchar(2) DEFAULT NULL, `type_confidence` double DEFAULT NULL, `zone` tinyint(2) DEFAULT NULL, `nasty` tinyint(3) unsigned DEFAULT NULL, `spin_dir` double unsigned NOT NULL, `spin_rate` double NOT NULL, `pitch_seq` varchar(55) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1;"; ?>