473,770 Members | 2,153 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mssql connection Call to undefined mssql_connect()

Actually, now I only test my webpage in a computer that I create as a server. And also I’m not too familiar in a server. Now I created a database in SQL Server 2005 Express and some of information I will share is:

I also used:
SQL Server 2005 Express
IIS 6.0
php 5.2.14

Server Type: Database Engine
Server name: ComputerName\SQ LEXPRESS
Authentication: Windows Authentication
Username: NETBIOS NAME\Administra tor [hide]
Password: [hide]

My problem is I cannot connect to my database using php and I don't know what username and password I should use if the Username: NETBIOS NAME\Administra tor Password: [no password]

This is my php code:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. //session_start(); 
  3. //session_regenerate_id(); 
  4.  
  5. //if($_SESSION['loggedin']){ 
  6. //the user is already logged in, lets redirect them to the other page 
  7.   //  header("Location:company.php"); 
  8. //} 
  9.  
  10.  
  11. $server = "Computer Name\SQLEXPRESS";
  12. $user = "NETBIOS\Administrator";
  13. $pass = "";
  14. $db_name="dbase"; 
  15.  
  16. //connection to database
  17. $dbhandle = mssql_connect($server, $user, $pass) or die ("Cannot connect to Server");
  18.  
  19. //mssql_connect($server, 'sa', 'pass') or die("Cannot connect to server"); 
  20. $selected = mssql_select_db($db_name, $dbhandle)or die("Cannot select DB");    
  21.  
  22.  
  23.         $department = $_POST['department'];    
  24.         $username = $_POST['username']; 
  25.  
  26.         $sql=mssql_query("SELECT `Department`, `Username` FROM `tbl_user` WHERE `Department` = '{$department}' AND Username = '{$username}'") or die(mssql_min_error_severity()); 
  27.         $ct = mssql_num_rows($sql); 
  28.  
  29.         if($ct == 1) { 
  30. // im guessing this means that the user is valid. 
  31. $_SESSION['loggedin'] = true; // now that the user is valid we change the session value. 
  32.             $row = mssql_fetch_assoc($sql);   
  33.  
  34.             //$_SESSION['username'] = $row['Username'] ;
  35.             //$_SESSION['department'] = $row['Department'];
  36.  
  37.             $Departments=array('Accounting', 'Engineering', 'Finishing_Goods', 'HRAD', 'MIS', 'Packaging_and_Design', 'Production', 'Purchasing_Logistic', 'QA_and_Technical', 'Supply_Chain');
  38.  
  39.             if (in_array($row['Department'], $Departments)){
  40.                     header ('Location:company.php');
  41.             }else{
  42.                     echo "Incorrect Username or Department";
  43.                     header ('Location:index.php');
  44.             }
  45.         }
  46. ?> 


I don't know if what configuration i need to do to work my connection. I configured php.ini like:

I uncommented the following:

extension_dir = "C:\php\ext "
extension=php_s qlsrv_52_ts_vc6 .dll
extension=php_b z2.dll
extension=php_c url.dll
extension=php_d ba.dll
extension=php_e xif.dll
extension=php_g d2.dll
extension=php_g ettext.dll

mssql.allow_per sistent=On
mssql.max_persi stent=-1
mssql_max_links =-1
mssql.min_error _severity=10
mssql.compatibi lity_mode=Off
mssql.connect_t imeout=5
mssql.timeout=6 0
mssql.textlimit =4096
mssql.textsize= 4096
mssql.batchsize =0
mssql.datetimec onvert=On
mssql.secure_co nnetion=Off

FreeTDS default to 4096
mssql.max_procs =25
mssql.charset = "ISO-8859-1"

After I commented out that in php.ini, I put all sqlsrv file in C:\php\ext and the ntwdlib.dll into C:\WINDOWS\syst em32. After that still when I run my webpage the error is still there. I have no idea how I can fix that error.


Error:
Fatal error: call to undefined function mssql_connect() in C:\Inetpub\wwwr oot\web_intrane t\index.php on line 17

I hope somebody can help or tell me what I should do.
Thank you
Sep 30 '10 #1
1 1929
ck9663
2,878 Recognized Expert Specialist
This is more of a PHP question first, than an MSSQL question. Search how you connect PHP to databases (oracle, sybase, access, mssql, etc). Then we go from there...

Try posting this in PHP forum, they might be able to help you more...

Good Luck!!!

~~ CK
Oct 1 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2102
by: Antonis Konstantinos | last post by:
Hi all, My Linux (k2.4.13) machine is now working with PHP 4.3.3 with Apache 1.3.28 and Mysql 4.0.15a.. I am now writing a script that connects to a MSSQL v8.0 server. In order to do this I want to use PHP. Then I have installed FreeTDS and tested its script on the command line and it works fine. When I write a piece of php line, my web server returns me that "Call to undefined function: mssql_connect()"
7
23876
by: mj | last post by:
Hello, thanks for the help. I am running a WinXP Pro w/ SP2 (my home computer, with ZoneAlarm firewall) Apache 2.0.52 MySQL 4.1.7 PHP 5.1.0-dev I have developed a PHP/MySQL web app that tracks jobs for me, and we
2
2972
by: Maniek | last post by:
Hi, Has anyone Pg linked to MSSQL or vice versa? I need to transfer some data MSSQL->PGSQL, but without writing a complex program. Maybe using Linked Server (MSSQL), ODBC / JDBC / OLE DB, but have no experience with this kind of jobs.
0
2216
by: dan | last post by:
Hi, I connect to a microsoft SQL server from php. Php is running on linux (debian sarge) with the freetds package. The connection is secured through stunnel (version 3.26), with stunnel running locally on the web server and locally on the SQL server machine. This means php connects locally to the stunnel port, which then establishes a secure connection to stunnel on the sql server. There the data is then transmitted locally to the SQL...
3
4330
by: gharmel | last post by:
I'm trying to get some clues on why I get (much) slower responses from my PHP applications when dealing with a remote sql server as opposed to a local sql server. Here's my situation: Server #1 MSSQL 2000 sp4 Windows 2000 Server PHP4 on IIS5 (CGI)
2
1417
by: grandmasterneil | last post by:
I have a couple of servers here at work that run IIS, MSSQL, and ASP.NET. I have PHP installed and running via Apache on my laptop. I was wondering if I can run code on my laptop (PHP/Apache) to access the information in the MSSQL databases here at work or do I have to install PHP onto the servers? Thanks in advance.
7
13951
by: RossM | last post by:
Hey, I am trying to connect to a MSSQL database but i keep getting the error "Compile error: User-defined type not defined". My code is below: Option Explicit Private Sub Text1_Change() Dim cnCon As ADODB.Connection
0
1362
by: menmaatre | last post by:
Hi all, I have a very odd problem: - System A: Win 2k3 with IIS 6 exposing a little WSDL Webservice - System B: Win 2k3 with MSSQL Server 2k5 - System C: RedHat Enterprise Server running apache 2.2.x with PHP5 and PHP Soap extension All systems are at the same subnet. xxx.xxx.xxx.10 / 11 / 12
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10228
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10002
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.