We help IT Professionals succeed at work.
Get Started

Fatel Error connecting to SQL through PHP page

Ryan Bayne
Ryan Bayne asked
on
1,128 Views
Last Modified: 2013-12-12
I can use php to connect to mysql with no problems but this is the first of me trying a mssql connection and I have a fatel error. Anything you can see I'm doing wrong from these details and anything I should do?

These are the two php extensions I uncommented...
extension=php_mssql.dll
extension=php_msql.dll

Dont worry about the password etc its all local and a university test database and access made up data.

Can you please confirm the  host and database settings. Database is the name of the database and host is something like RRB/SQLEXPRESS?   Just need to make sure I know the basics.

HERE IS THE ERROR
Fatal error: Call to undefined function mssql_connect() in C:\AppServ\www\ifolio\test.php on line 21
<?php
  /* Program: PetCatalog.php
   * Desc:    Displays a list of pet categories from the
              PetType table. Includes descriptions.
   *          User checks radio button.
   */
 
//...code...
?>
<html>
<head><title>PHP Test Page</title></head>
<body>
 
<?php
 
  $user="ifolio";
  $host="SQLEXPRESS";
  $password="25130217cmt";
  $database="test";
 
$Conn = mssql_connect("SQLEXPRESS","test","25130217cmt") or die("Unable to connect to server");
 
$Db=mssql_select_db("test",$Conn);
 
 
  $query = "SELECT * FROM test";#
  while($RS = mssql_fetch_array($SQL))
{
echo 'test'.$RS['test'].' ';
 
}
mssql_close($Conn);    
 
  $result = mssql_query($query)
       or die ("Couldn't execute query.");              #21
 
?>
</div>
</body></html>

Open in new window

Comment
Watch Question
Developer | Solutions Architect | CTO
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 12 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE