惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Vulnerabilities – Threatpost
F
Fortinet All Blogs
Vercel News
Vercel News
C
Check Point Blog
P
Privacy International News Feed
Know Your Adversary
Know Your Adversary
Google DeepMind News
Google DeepMind News
T
Troy Hunt's Blog
TaoSecurity Blog
TaoSecurity Blog
I
Intezer
T
The Exploit Database - CXSecurity.com
Security Archives - TechRepublic
Security Archives - TechRepublic
H
Hacker News: Front Page
P
Proofpoint News Feed
GbyAI
GbyAI
Engineering at Meta
Engineering at Meta
Attack and Defense Labs
Attack and Defense Labs
S
Security @ Cisco Blogs
IT之家
IT之家
D
DataBreaches.Net
Hacker News: Ask HN
Hacker News: Ask HN
SecWiki News
SecWiki News
Y
Y Combinator Blog
Project Zero
Project Zero
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
Lohrmann on Cybersecurity
T
Tenable Blog
大猫的无限游戏
大猫的无限游戏
L
LINUX DO - 最新话题
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
Recorded Future
Recorded Future
有赞技术团队
有赞技术团队
Martin Fowler
Martin Fowler
K
Kaspersky official blog
PCI Perspectives
PCI Perspectives
A
Arctic Wolf
Latest news
Latest news
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
Netflix TechBlog - Medium
雷峰网
雷峰网
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
P
Palo Alto Networks Blog
The Hacker News
The Hacker News
WordPress大学
WordPress大学
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
月光博客
月光博客
Schneier on Security
Schneier on Security
M
MIT News - Artificial intelligence

博客园 - 农村的芬芳

PHP使用第三篇:生成数据库 从今天开始记录PHP使用的点点滴滴 留给自个看的工具提示 转xml Oracle 跨库 查询 复制表数据 关于海量数据处理 近日用到啦progressbar控件,将其用法留一下 select into 和 insert into select 两种表复制语句 采用regsvr32注册组件后提示:没有注册 net2005中将list<>数组转换为Table 将对象数组转换成dataset windows 服务操作 转载:XML与DataSet的相互转换类 oracle 日期函数小计 如何创建自定义帐户来运行 ASP.NET 通过ASP.net程序创建域帐户故障 EnterpriseLibrary服务问题 下载文件关闭窗体之解决方法 超级郁闷之问题,请DUDU及各位大位指正错误
使用THINKPHP产生的:No database selected [问题
农村的芬芳 · 2013-12-04 · via 博客园 - 农村的芬芳

开发环境:wampserver2.4

Apache : 2.4.4 MySQL : 5.6.12 PHP : 5.4.12 PHPMyAdmin : 4.0.4 SqlBuddy : 1.3.3 XDebug : 2.2.3


开发框架:thinkphp3.1.3完全版。
步骤:
1.在数据库中添加数据库test,添加表userinfo,添加一条记录。


2.修改配置文件:

<?php
if (!defined('THINK_PATH')) exit();
return array(
//'配置项'=>'配置值'
//数据库配置信息
'DB_TYPE' => 'mysql', // 数据库类型
'DB_HOST' => 'localhost', // 数据库服务器地址
'DB_NAME' => 'test', // 数据库名
'DB_USER' => 'root', // 数据库用户名
'DB_PWD' => '', // 数据库密码

'DB_PORT' => 3306, // 数据库端口
'DB_CHARSET' => 'utf8', // 数据库编码
'DB_PREFIX' => 'think_', // 数据库表前缀
//'DB_PREFIX' => 'ts_', // 数据库表前缀(因为漫游的原因,数据库表前缀必须写在本文件)
//其他项目配置参数
// ...
//'SHOW_PAGE_TRACE' =>true, // 显示页面Trace信息
//'APP_DEBUG' => false,

);
?>

3.在UserinfoAction.class.php的index方法中添加代码:

$first ='第一次输出这是';
$this->assign('first',$first);
$userinfo=M('userinfo');
$list=$userinfo->select();
dump($list);
if($userinfo->select())
{
$this->assign('alist',$list);
}
else
echo $userinfo->getDbError();

$this->display('userinfo');

4,在浏览器中输入:http://localhost/Test/Admin.php/userinfo/
5.测试结果:
select * from userinfo
boolean false
1046:No database selected [ SQL璇彞 ] : select * from userinfo

我已经设置了数据库了,错误却提示没有选择数据库,怎么回事呢?

费了好大久,怎么改都不行,查来查去,终于找到一个和我这个类似的原因了,解决办法如下:

设置方法:控制面板-用户账户和家庭安全-系统和安全-行动中心,里面有“更改用户账户控制设置”,改成从不通知,完成后会提示重启,此时需要重启一下。

我照这个方法修改,系统果然要重启,很好,窃喜一下,以为要好了呢,没想启动后,打开浏览器还是不行,,,,,郁闷了

在无路的时候,突然想到了,runtime这个文件夹,对了运行时缓存,影响很大,一定要删除一下,果然一删除天下太平了,全都出来了