dbconnect函数错误

Somewhere within my dbconnect function it is not close in the right spot. I have been over and over it and I still can't find it. here is my dbconnect function:

    function dbConnect(){
     // Connect to the database:
     $hostname="localhost";
     $database="tblFile";
     $mysql_login="valerie2_shuawna";
     $mysql_password="norris";

     if(!($db=mysql_connect($hostname, $mysql_login, $mysql_password))){
        echo"error on connect";
     }
     else{
        if(!(mysql_select_db($database,$db))){
            echo mysql_error();
            echo "<br />error on database connection. Check your settings.";
        }
        else{
                    echo "I have successfully made a connection to my database and everything
     is working as it should.";
   }
}

then here is another part that has the dbconnect():

dbConnect();
    $SQL="SELECT fileID FROM tblFile WHERE fileName='".$result."'";
    //echo $SQL;
    $rs=mysql_query($SQL);
    echo mysql_num_rows($rs);
    if(mysql_num_rows($rs)!=0){
        $extension=strrchr($result,'.');
        $result=str_replace($extension,time(),$result);
        $result=$result.$extension;
    }
    return $result;
}

I cant not find where it is not seeing where it should be closed at.

In the first part of your code you are missing a bracket

And I will suggest you to use this form of the if statements

function dbConnect()
{
     // Connect to the database:
     $hostname="localhost";
     $database="tblFile";
     $mysql_login="valerie2_shuawna";
     $mysql_password="norris";

     if(!($db=mysql_connect($hostname, $mysql_login, $mysql_password))):
        echo"error on connect";
     else:
        if(!(mysql_select_db($database,$db))):
            echo mysql_error();
            echo "<br />error on database connection. Check your settings.";
        else:
            echo "I have successfully made a connection to my database and everything is working as it should.";
        endif; 
   endif; 
}

Tell me the result