PHP
·
发表于 5年以前
·
阅读量:8301
首先建立数据库cake_ext,并执行如下sql文:
companies
(id
int(11) NOT NULL auto_increment,company
varchar(50) NOT NULL,price
decimal(8,2) NOT NULL,change
decimal(8,2) NOT NULL,lastudp
date NOT NULL,id
)companies
VALUES ('1', '3m Co', '71.72', '0.02', '2008-10-21');companies
VALUES ('2', 'Alcoa Inc', '29.01', '0.42', '2008-10-20');companies
VALUES ('3', 'AT&T; Inc.', '31.61', '-0.48', '2008-10-21');companies
VALUES ('4', 'Boeing Co.', '75.43', '0.53', '2008-10-13');companies
VALUES ('5', 'United Technologies Corporation', '63.26', '0.55', '2008-10-09');companies
VALUES ('6', 'Intel Corporation', '19.88', '0.31', '2008-10-15');companies
VALUES ('7', 'Exxon Mobil Corp', '68.10', '-0.43', '2008-10-17');如下图所示建立工程:
数据库配置文件如下:
**var** $test = **array**('driver' => 'mysql',
companies_controller.php:
company.php: