新手学习PHP+MYSQL的一个小问题,求指点

onoyoule 发布于 2012/10/27 12:49
阅读 804
收藏 0
 

如题,本人刚学PHP,apmserv搭了环境,建立数据库data1,在默认htdocs文件夹中放了一网站web1,在127.0.0.1 user1能正常打开。然后尝试一下操作:    1、复制了data1,命名为data2,设置use1不能操作data2user2不能操作data1.  2、复制web1,放在htdocs文件夹中,也就是同时有web1web2.

3、修改了web2文件夹中 config.inc.php 文件中数据库参数。

问题: web1能正常打开。web2出错。错误如下

Database error: cannot use database data2
MySQL Error: 0 ()
#0 dbbase_sql->halt(cannot use database data2) called at [E:\APM1\www\htdocs\web2\includes\db.inc.php:42] #1 dbbase_sql->connect() called at [E:\APM1\www\htdocs\web2\includes\db.inc.php:58] #2 dbbase_sql->query(select * from {P}_base_config) called at [E:\APM1\www\htdocs\web2\includes\common.inc.php:42] #3 readconfig() called at [E:\APM1\www\htdocs\web2\includes\common.inc.php:32] #4 include(E:\APM1\www\htdocs\web2\includes\common.inc.php) called at [E:\APM1\www\htdocs\web2\index.php:3] Database error: Invalid SQL: select * from pwn_base_config
MySQL Error: 1046 (No database selected)
#0 dbbase_sql->halt(Invalid SQL: select * from pwn_base_config) called at [E:\APM1\www\htdocs\web2\includes\db.inc.php:65] #1 dbbase_sql->query(select * from {P}_base_config) called at [E:\APM1\www\htdocs\web2\includes\common.inc.php:42] #2 readconfig() called at [E:\APM1\www\htdocs\web2\includes\common.inc.php:32] #3 include(E:\APM1\www\htdocs\web2\includes\common.inc.php) called at [E:\APM1\www\htdocs\web2\index.php:3]
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\APM1\www\htdocs\web2\includes\db.inc.php on line 72
Database error: Invalid SQL: select * from pwn_base_pageset where coltype='index' and pagename='index'
MySQL Error: 1046 (No database selected)
#0 dbbase_sql->halt(Invalid SQL: select * from pwn_base_pageset where coltype='index' and pagename='index') called at [E:\APM1\www\htdocs\web2\includes\db.inc.php:65] #1 dbbase_sql->query(select * from {P}_base_pageset where coltype='index' and pagename='index') called at [E:\APM1\www\htdocs\web2\includes\common.inc.php:90] #2 pageset(index, index) called at [E:\APM1\www\htdocs\web2\index.php:7]
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\APM1\www\htdocs\web2\includes\db.inc.php on line 72
Database error: Invalid SQL: select * from pwn_base_plus where plustype='' and pluslocat='' and display!='none' order by zindex
MySQL Error: 1046 (No database selected)
#0 dbbase_sql->halt(Invalid SQL: select * from pwn_base_plus where plustype='' and pluslocat='' and display!='none' order by zindex) called at [E:\APM1\www\htdocs\web2\includes\db.inc.php:65] #1 dbbase_sql->query(select * from {P}_base_plus where plustype='' and pluslocat='' and display!='none' order by zindex) called at [E:\APM1\www\htdocs\web2\includes\common.inc.php:374] #2 printpage() called at [E:\APM1\www\htdocs\web2\index.php:11]
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\APM1\www\htdocs\web2\includes\db.inc.php on line 72
Database error: Invalid SQL: select * from pwn_advs_pop where ifpop='1'
MySQL Error: 1046 (No database selected)
#0 dbbase_sql->halt(Invalid SQL: select * from pwn_advs_pop where ifpop='1') called at [E:\APM1\www\htdocs\web2\includes\db.inc.php:65] #1 dbbase_sql->query(select * from {P}_advs_pop where ifpop='1') called at [E:\APM1\www\htdocs\web2\includes\common.inc.php:1404] #2 winpop() called at [E:\APM1\www\htdocs\web2\includes\common.inc.php:628] #3 printpage() called at [E:\APM1\www\htdocs\web2\index.php:11]
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\APM1\www\htdocs\web2\includes\db.inc.php on line 72

 

请大家帮我看看是哪里的问题。应怎么修改。不胜感谢!!!

加载中
0
小鑫fork
小鑫fork
让你用windows!
0
紅著

很显然是你的数据库设置有问题!
你没有建另外数据库,所以WEB2中的 config.inc.php 文件中数据库参数不用改,如果要改,那么请你新建一个让WEB2使用的数据库!

返回顶部
顶部