SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Jul 2010
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    call to undefined function mssql_connect()

    Good day!

    I change my database from sql yog to SQL Server 2005 Express so in php the connection is different, so now I am new in SQL Server 2005 Express. i edit my login page and I encountered error:

    Fatal error: Call to undefined function mssql_connect() in C:\Inetpub\wwwroot\web_intranet\index.php on line 14

    here is my code:
    PHP Code:
    <?php  
    session_start
    ();  
    session_regenerate_id();  

    if(
    $_SESSION['loggedin']){  
    //the user is already logged in, lets redirect them to the other page  
        
    header("Location:company.php");  
    }  

    //require_once 'conn.php';    
    $server "PDOMAIN\MSFW"
    $db_name="dspi";  

    mssql_connect($server) or die("Cannot connect to server");  
    mssql_select_db("$db_name")or die("Cannot select DB");     


            
    $department $_POST['department'];     
            
    $username $_POST['username'];  

            
    $sql=mssql_query("SELECT `Department`, `Username` FROM `tbllogin` WHERE `Department` = '{$department}' AND Username = '{$username}'") or die(mssql_min_error_severity());  
            
    $ct mssql_num_rows($sql);  
           
            if(
    $ct == 1) {  
    // im guessing this means that the user is valid.  
    $_SESSION['loggedin'] = true// now that the user is valid we change the session value.  
                
    $row mssql_fetch_assoc($sql);    
                 
                
    //$_SESSION['username'] = $row['Username'] ; 
                //$_SESSION['department'] = $row['Department']; 
                 
                
    $Departments=array('Accounting''Engineering''Finishing_Goods''HRAD''MIS''Packaging_and_Design''Production''Purchasing_Logistic''QA_and_Technical''Supply_Chain'); 
                 
                if (
    in_array($row['Department'], $Departments)){ 
                        
    header ('Location:company.php'); 
                }else{ 
                        echo 
    "Incorrect Username or Department"
                        
    header ('Location:index.php'); 
                } 
            } 
    ?>

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Have you enabled the mssql extension in your php.ini ?
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Addict
    Join Date
    Jul 2010
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AnthonySterling View Post
    Have you enabled the mssql extension in your php.ini ?
    no...how?

  4. #4
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    See the link I posted.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  5. #5
    SitePoint Addict
    Join Date
    Jul 2010
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AnthonySterling View Post
    See the link I posted.
    thank you

  6. #6
    SitePoint Addict
    Join Date
    Jul 2010
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rhodarose View Post
    thank you
    i commented out the mssql extension but still the my webpage did not appear and the error is still there


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •