PHPMYSQL help !!!! ThinkPHP Framework & nbsp; publicfunctionselect () {& nbsp; $ db_dsn & quot; mysql: root: [email & #160; protected]: 3306my_table & quot; & nbsp; $ dbnewDb ($ db_dsn) php mysql help !!!!
ThinkPHP framework
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/index. php/Index/select
When the database is set to all-right, how does it become blank after access? Can someone help me?
------ Solution --------------------
Echo $ db-> execute ("select * from think_person ");
You can change it to dump ($ db-> execute ("select * from think_person.
++
Configure the database as follows:
// 'Config maps '=> 'configuration value'
'Db _ type' => 'mysql ',
'Db _ host' => 'localhost ',
'Db _ name' => 'test ',
'Db _ user' => 'root ',
'Db _ pwd' => '123 ',
'Db _ port' => '123 ',
'Db _ prefix' => 'think _',
Write an Action:
Function get_data ()
{
$ Db = M ('user ');
Dump ($ db-> where ('Id = 1')-> select ());
}