[請益] MySQL 不穩?

作者: KawasumiMai (さあ、死ぬがいい)   2014-12-23 11:23:21
這情況應該是換到XAMPP架設之後才有的狀況
之前沒發生過
好像在連到MySQL的時候"偶爾"會有Warning
只有第一次進去的時候會發生(利用Session檢測自動登入並Check MySQL)
之後的操作上不會有有任何問題(一樣引用sql_infor
因為同樣是引用sql_infor
所以照理說 帳密 DB 應該不會有錯
而且也不是每次都會發生這樣的狀況
但是每次發生時的錯誤訊息都一樣
看起來在mysql_connect就出錯了
是因為當下sql連線失敗嗎?
錯誤訊息:
Warning: mysql_connect(): in
C:\*********\sql_infor.php on line 2
Warning: mysql_select_db() expects parameter 2 to be resource, boolean given
in C:\*********\sql_infor.php on line 3
Warning: mysql_query() expects parameter 2 to be resource, boolean given in
C:\*********\sql_infor.php on line 4
Warning: mysql_query() expects parameter 2 to be resource, boolean given in
C:\*********\session.php on line 12
Warning: mysql_fetch_array() expects parameter 1 to be resource, null given
in C:\*********\session.php on line 13
session.php
========================================
include("sql_infor.php");
include("CodeSystem.php");
session_start();
$permission=false;
$key="PrivateKey";
if(isset($_SESSION["A"]) && $_SESSION["A"]=="True"){
$sql="SELECT * FROM `sheet`;";
$result=mysql_query($sql,$link); <<<12
while($row=mysql_fetch_array($result)){ <<<13
========================================
sql_infor.php
========================================
$link=mysql_connect('127.0.0.1','username','password'); <<<2
mysql_select_db('dbname',$link); <<<3
mysql_query('SET NAMES UTF8',$link); <<<4

Links booklink

Contact Us: admin [ a t ] ucptt.com