Home >Backend Development >PHP Tutorial >PHP MYSQL 救命呀!该如何处理

PHP MYSQL 救命呀!该如何处理

WBOY
WBOYOriginal
2016-06-13 10:08:27857browse

PHP MYSQL 救命呀!!!!
ThinkPHP框架
  public function select() {
  $db_dsn = "mysql://root:[email protected]: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());
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn