Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Call to undefined function mssql_connect()
Old 09-21-2010, 11:50 PM Call to undefined function mssql_connect()
Skilled Talker

Posts: 97
Name: rhoda
Trades: 0
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');  
            }  
        }  
?>
By the way i use Windows Server 2003, IIS, php 4.3.4, and SQL Server 2005 Express
I already configure the php.ini to read mssql.
I also check if I have ntwdblib.dll and i have it.
but still i cannot connect to sql.
newphpcoder is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-22-2010, 08:29 AM Re: Call to undefined function mssql_connect()
Experienced Talker

Posts: 41
Name: vinay
Trades: 0
first tell me which server are you using to run your php script.. is it IIS server or wamp or xamp.. i think if you are using Microsoft IIS server . you cant do because IIS support only sql server not mysql
vinay.desi9n is offline
Reply With Quote
View Public Profile
 
Old 09-22-2010, 08:33 AM Re: Call to undefined function mssql_connect()
Ultra Talker

Posts: 366
Name: Steve
Location: Miami, FL, Earth
Trades: 0
The problem is that you rmssql extension isn't properly configured in php.

Look in your ext folder for php_mssql.dll (assuming you're on a windows box), and check your php.ini to see that mssql is configured.
__________________
- Steve

President,
Please login or register to view this content. Registration is FREE
smoseley is offline
Reply With Quote
View Public Profile Visit smoseley's homepage!
 
Reply     « Reply to Call to undefined function mssql_connect()
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.66251 seconds with 12 queries