首頁 >後端開發 >php教程 >PHP MYSQL 救命呀!该如何处理

PHP MYSQL 救命呀!该如何处理

WBOY
WBOY原創
2016-06-13 10:08:27866瀏覽

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());
}

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn