<?php 
$dbh = mysql_connect('192.168.6.101','hanine','hanine'); 
mysql_select_db('hanline'); 
?>
你试试这样看行不行
<?php 
$dbh = mysql_connect('192.168.6.101','hanine',''); 
$select=mysql_select_db('hanline'); 
?>

解决方案 »

  1.   

    conn.php文件不存在!
    他应该在F:\PHP\hanline\目录下
      

  2.   

    checklogin.php
    就是登陆检测页面
      

  3.   

    <?php
    $dbh = mysql_connect('192.168.6.101','hanine','hanine'); 
    $select = mysql_select_db('hanline'); session_start(); //  session
    $UserName = $_POST['UserName'];
    $PassWord = $_POST['PassWord'];
    $checkNumber = $_POST['checkNumber'];
    $sessioncode = $_SESSION['code'];
    $_SESSION['code']="";//按条件取出表中帐号记录
    $sql = "select adminname,adminpass from  admin  where adminname = '" . $UserName ."' and adminpass = '" . $PassWord . "'";
    $result = mysql_query($sql);
    if ($result->EOF)
    {
    echo "<script>";
    echo "location='uLoginFalse.php';"; //连接至错误页
    echo "</script>";
    }
    elseif ($checkNumber<>$sessioncode)
    {
    echo "<script>";
    echo "location='uLoginFalse.php';"; //连接至错误页
    echo "</script>";
    }
    else
    {
    //setcookie("cookieid",
    $_SESSION['UserName']=$UserName;
    echo "<script>";
    echo "location='uMain.php';"; ////连接至会员功能页
    echo "</script>";
    }
    mysql_free_result();  //释放资源
    mysql_close();
    ?>
      

  4.   

    你确定你的php配置文件配好了吗?你用phpinfo()函数看一下,检查mysql的用户名和密码,是不是'hanine'和'hanine'
      

  5.   

    Warning: mysql_select_db() [function.mysql-select-db]: Can't connect to MySQL server on 'localhost' (10061) in F:\PHP\hanline\inc\conn.php on line 3Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in F:\PHP\hanline\inc\conn.php on line 3Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at F:\PHP\hanline\inc\conn.php:2) in F:\PHP\hanline\member\checklogin.php on line 3Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at F:\PHP\hanline\inc\conn.php:2) in F:\PHP\hanline\member\checklogin.php on line 3
      

  6.   

    为什么我用代码连同事的mysql就连不上呢??
    if  ($dbh = mysql_connect('192.168.6.101','hanine','hanine'))     
    {   
    echo  "SUCCESS  !  Connected  to  database\n";   
    }     
    else     
    {   
    echo  "Failed  :-(  Could  not  connect  to  database\n";   

     phpinfo(); 
    exit; 
    mysql_select_db('hanline'); 我这样试了,连不上