<?php
//database connectivity
$connect_error='Sorry We could not able to connect to the database';
mysql_connect('localhost','root','') or die($connect_error);
mysql_select_db('beehive_intwebpage') or die ($connect_error);
?>
我們已經在我們的localhost中設置了這個。當沒有與數據庫連接時,我們會收到錯誤消息和錯誤消息。MySQL錯誤消息以及PHP錯誤消息
警告:mysql_connect():由於目標機器主動拒絕它,因此無法建立連接。在d:\上線核心\數據庫\ connect.php 3
很抱歉我們無法連接到數據庫
如何只顯示消息,而不是默認的SQL錯誤。
謝謝!
可能重複的[mysql \ _connect():無法建立連接,因爲目標機器主動拒絕它](http://stackoverflow.com/questions/21987746/mysql-connect-no-connection-因爲目標機器積極) – e4c5