Jump to content

call to undefined function mssql_connect()


newphpcoder

Recommended Posts

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 
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');
		}
	}
?> 

 

            //$_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');

            }

        }

?> i already enable extension mssql in php.ini

 

Link to comment
Share on other sites

hope u hv answer here

For the mssql extension to work, all of the following must be true -

 

The php.ini that you are changing must be the one that php is using.

 

The php_mssql.dll must be in the ext folder.

 

The extension_dir setting in php.ini must be set to the ext folder, something like  extension_dir = c:\php\ext

 

To get changes made to php.ini to take effect, you must stop and start the IIS web service. Do this in the services control panel or reboot your computer. Just stopping and starting the web site in the IIS management console is not enough.

 

mssql requires: ntwdblib.dll to be available on the Windows PATH. It is better to add the php folder to the Windows PATH instead of moving any files around. Re-logon or reboot your computer to get any changes made to the Windows PATH statement to take effect.

 

The php folder must have proper permissions set to allow the IIS user account to read the files in the php folder and in the ext folder.

Link to comment
Share on other sites

hope u hv answer here

For the mssql extension to work, all of the following must be true -

 

The php.ini that you are changing must be the one that php is using.

 

The php_mssql.dll must be in the ext folder.

 

The extension_dir setting in php.ini must be set to the ext folder, something like  extension_dir = c:\php\ext

 

To get changes made to php.ini to take effect, you must stop and start the IIS web service. Do this in the services control panel or reboot your computer. Just stopping and starting the web site in the IIS management console is not enough.

 

mssql requires: ntwdblib.dll to be available on the Windows PATH. It is better to add the php folder to the Windows PATH instead of moving any files around. Re-logon or reboot your computer to get any changes made to the Windows PATH statement to take effect.

 

The php folder must have proper permissions set to allow the IIS user account to read the files in the php folder and in the ext folder.

The php.ini is thge php.ini thta i'm using.the php_mssql.dll is on the extension folder. I also stop and start the IIS Server. I also put php folder in windows. but still my connection in mssql was failed

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.