当前位置:Gxlcms > PHP教程 > PHPMYSQL救命呀!该如何处理

PHPMYSQL救命呀!该如何处理

时间:2021-07-01 10:21:17 帮助过:67人阅读

PHP MYSQL 救命呀!!!!
ThinkPHP框架
public function select() {
$db_dsn = "mysql://root:guozhixin@localhost:3306/my_table";
$db = new Db($db_dsn);
echo $db->execute("select * from think_person");
}

http://127.0.0.1/iBaby/iBaby/index.php/Index/select

数据库设置全对,怎么就是访问以后是一片空白呢?有人能帮帮我吗?

------解决方案--------------------
echo $db->execute("select * from think_person");

你改成: dump($db->execute("select * from think_person")); 试试。

++++++++++++++++++++++++++++++++++++++++

如下为数据库配置:
//'配置项'=>'配置值'
'DB_TYPE'=>'mysql',
'DB_HOST'=>'localhost',
'DB_NAME'=>'test',
'DB_USER'=>'root',
'DB_PWD'=>'123456',
'DB_PORT'=>'3306',
'DB_PREFIX'=>'think_',
写一个Action:
function get_data()
{
$db=M('User');
dump($db->where('id=1')->select());
}

人气教程排行