Web Hosting Talk







View Full Version : Graphing MySQL data using PHP


calidude
04-16-2008, 10:29 PM
I've filled a MySQL database with some data and now I want to graph it using PHP, but I don't know how. Any ideas?:confused:

Just FYI, I want it to look like the example below:

http://www.wrh.noaa.gov/images/sgx/cliplot/KSNA2008plot.png

and this is a sample of my MySQL dump:

--
-- Table structure for table `who_farted`
--

DROP TABLE IF EXISTS `who_farted`;
CREATE TABLE IF NOT EXISTS `who_farted` (
`Date` date NOT NULL default '0000-00-00',
`Max Daily Highs` tinyint(3) NOT NULL default '0',
`Avg Daily Highs` tinyint(3) NOT NULL default '0',
`Daily Highs` tinyint(3) NOT NULL default '0',
`Daily Lows` tinyint(3) NOT NULL default '0',
`Avg Daily Lows` tinyint(3) NOT NULL default '0',
`Min Daily Lows` tinyint(3) NOT NULL default '0',
`Max Daily Rain` decimal(2,2) NOT NULL default '0.00',
`Min Daily Rain` decimal(2,2) NOT NULL default '0.00',
`Avg Daily Rain` decimal(2,2) NOT NULL default '0.00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `who_farted`
--

INSERT INTO `who_farted` (`Date`, `Max Daily Highs`, `Avg Daily Highs`, `Daily Highs`, `Daily Lows`, `Avg Daily Lows`, `Min Daily Lows`, `Max Daily Rain`, `Min Daily Rain`, `Avg Daily Rain`) VALUES
('2008-01-01', 78, 67, 76, 45, 47, 32, 0.47, 0.00, 0.02),
('2008-01-02', 82, 67, 72, 49, 48, 29, 0.61, 0.00, 0.06),
('2008-01-03', 81, 67, 66, 49, 48, 31, 0.82, 0.00, 0.08),
('2008-01-04', 81, 67, 61, 54, 47, 33, 0.99, 0.00, 0.15),
('2008-01-05', 89, 66, 58, 55, 47, 34, 0.99, 0.00, 0.20),

(insert 360 other rows of data here)

Panopta
04-17-2008, 10:22 AM
Check out ChartDirector at http://www.advsofteng.com/ - they have pretty broad language support, including PHP.