跪求PHP高手(怎样用一个PHP建立下列表)

DROPVIEWIFEXISTS`type_base`;CREATEVIEW`type_base`ASSELECT*FROM`base_attr`WHERE`base_t... DROP VIEW IF EXISTS `type_base`;
CREATE VIEW `type_base` AS
SELECT * FROM `base_attr` WHERE `base_type`=2 AND `type`=0;

DROP VIEW IF EXISTS `status_base`;
CREATE VIEW `status_base` AS
SELECT * FROM `base_attr` WHERE `base_type`=3 AND `type`=0;

DROP VIEW IF EXISTS `type_account`;
CREATE VIEW `type_account` AS
SELECT * FROM `base_attr` WHERE `base_type`=2 AND `type`=1;

DROP VIEW IF EXISTS `status_account`;
CREATE VIEW `status_account` AS
SELECT * FROM `base_attr` WHERE `base_type`=3 AND `type`=1;

DROP VIEW IF EXISTS `type_customer`;
CREATE VIEW `type_customer` AS
SELECT * FROM `base_attr` WHERE `base_type`=2 AND `type`=2;

DROP VIEW IF EXISTS `status_customer`;
CREATE VIEW `status_customer` AS
SELECT * FROM `base_attr` WHERE `base_type`=3 AND `type`=2;

DROP VIEW IF EXISTS `type_organization`;
CREATE VIEW `type_organization` AS
SELECT * FROM `base_attr` WHERE `base_type`=2 AND `type`=3;

DROP VIEW IF EXISTS `status_organization`;
CREATE VIEW `status_organization` AS
SELECT * FROM `base_attr` WHERE `base_type`=3 AND `type`=3;

DROP VIEW IF EXISTS `type_position`;
CREATE VIEW `type_position` AS
SELECT * FROM `base_attr` WHERE `base_type`=2 AND `type`=4;

DROP VIEW IF EXISTS `status_position`;
CREATE VIEW `status_position` AS
SELECT * FROM `base_attr` WHERE `base_type`=3 AND `type`=4;

DROP VIEW IF EXISTS `type_person`;
CREATE VIEW `type_person` AS
SELECT * FROM `base_attr` WHERE `base_type`=2 AND `type`=5;

DROP VIEW IF EXISTS `status_person`;
CREATE VIEW `status_person` AS
SELECT * FROM `base_attr` WHERE `base_type`=3 AND `type`=5;

DROP VIEW IF EXISTS `type_message`;
CREATE VIEW `type_message` AS
SELECT * FROM `base_attr` WHERE `base_type`=2 AND `type`=6;

DROP VIEW IF EXISTS `status_message`;
CREATE VIEW `status_message` AS
SELECT * FROM `base_attr` WHERE `base_type`=3 AND `type`=6;

DROP VIEW IF EXISTS `type_asset`;
CREATE VIEW `type_asset` AS
SELECT * FROM `base_attr` WHERE `base_type`=2 AND `type`=7;

DROP VIEW IF EXISTS `status_asset`;
CREATE VIEW `status_asset` AS
SELECT * FROM `base_attr` WHERE `base_type`=3 AND `type`=7;

DROP VIEW IF EXISTS `type_relation`;
CREATE VIEW `type_relation` AS
SELECT * FROM `base_attr` WHERE `base_type`=2 AND `type`=8;

DROP VIEW IF EXISTS `status_relation`;
CREATE VIEW `status_relation` AS
SELECT * FROM `base_attr` WHERE `base_type`=3 AND `type`=8;

DROP VIEW IF EXISTS `type_block_list`;
CREATE VIEW `type_block_list` AS
SELECT * FROM `base_attr` WHERE `base_type`=2 AND `type`=9;

DROP VIEW IF EXISTS `status_block_list`;
CREATE VIEW `status_block_list` AS
SELECT * FROM `base_attr` WHERE `base_type`=3 AND `type`=9;
展开
 我来答
逐风者雷霆之惹
2011-04-29 · TA获得超过976个赞
知道小有建树答主
回答量:523
采纳率:0%
帮助的人:734万
展开全部
在前面加上下面三行
$link = mysql_connect($host,$username,$password);
$re = mysql_select_db($db_name);
mysql_query('set names utf9');

每一个sql语句都改成下面这样
mysql_query("DROP VIEW IF EXISTS `status_block_list`;
CREATE VIEW `status_block_list` AS
SELECT * FROM `base_attr` WHERE `base_type`=3 AND `type`=9");
追问
我晕  我是说怎么用PHP语言吧这些表建完,不是改写sql语句!
还有 我擦 你说的根本就是全错。除了前面几句不沾边的...
追答
...咱能正经点儿不?
mysql_query就是执行SQL语句的好不
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式