建立連接的同時不能打開數據庫
我如果這樣$mysqli = new mysqli('localhost','root','root','test');就會有錯誤信息
Warning: mysqli::mysqli() [mysqli.mysqli]: (42000/1049): Unknown database 'test' in?C:\Users\Administrator\PhpstormProjects\Char\mysqli_connect_1.php?on line?13
Connect Error:Unknown database 'test'
這樣去就沒問題$mysqli = new mysqli('localhost','root','root');
$mysqli->select_db('test');
求大神解答
2017-04-28
要學會看錯,英文不好的話,建議用谷歌翻譯,因為這個翻譯比較標準
2017-04-28
你的錯誤應該是:
警告:mysqli :: mysqli()[mysqli.mysqli]:(42000/1049):未知的數據庫'test'在C:\ Users \ Administrator \ PhpstormProjects \ Char \ mysqli_connect_1.php第13行連接錯誤:未知數據庫'test'
test是未知的數據庫,你確定有這個數據庫