跪求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; 展开
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; 展开
1个回答
展开全部
在前面加上下面三行
$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");
$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语句的好不
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询