[php] connectie naar MSSQL server gaat niet

Pagina: 1
Acties:

  • BierPul
  • Registratie: Juni 2001
  • Laatst online: 10:59

BierPul

2 koffie graag

Topicstarter
Ik probeer via volgend script naar mn MSSQL server te connecten (deze staat gewoon lokaal)
PHP:
1
2
3
4
5
6
7
8
9
<?
$hostname = "localhost"; 
$username = "major_league"; 
$password = ".....";
$dbName = "ml75"; 

MSSQL_CONNECT($hostname,$username,$password) or DIE("DATABASE FAILED TO RESPOND."); 
mssql_select_db($dbName) or DIE("Table unavailable"); 
?>

Lijkt me niets mis mee maar ik krijg de volgende melding terug ....


Fatal error: Call to undefined function: mssql_connect() in D:\Webdev\index.php on line 8

verander ik mssql_connect naar mysql_connect dan werkt ie wel zegt ie alleen dat er geen db_server is (dat klopt)

Iemand een ID want ik ben radeloos :(

Ja man


Verwijderd

PHP:
1
2
3
4
<?
mysql_connect($hostname,$username,$password) or die("De database server is kaput!");
@mysql_select_db("$dbName") or die("Heeey! Er zijn problemen met de database!!!");
?>

Dit moet werken, anders heb je een probleem op de server zelf.

Als je een var aanroept en er zitten niet alleen maar cijfers in moet je "" gebruiken, dat was je vergeten denk ik ;)

  • LuCarD
  • Registratie: Januari 2000
  • Niet online

LuCarD

Certified BUFH

Je hebt in PHP de MSSQL support nog niet mee gecompileerd cq aangezet!.

Voor windows:
Wijzig je PHP.INI
haal de ; weg voor de lijn of voeg de lijn toe!
;extension=php_mssql.dll

Voor *nix varianten:
ga naar de php.net site en lees hoe je de mssql support moet compileren... het staat in de manual lees vooral de notes bij de manual, daar staan een aantal bruikbare tips!

Programmer - an organism that turns coffee into software.


Verwijderd

Uit een opmerking bij de manual:
STEP 1: Follow the README.txt include with the php-4.0.1pl2-Win32.zip file.


STEP 2: Make sure you copy the .dll(s) you want to use LIKE php_mssql70.dll to the SYSTEM directory (eg: C:\WINDOWS\SYSTEM or C:\WINNT\SYSTEM32).


STEP 3: Copy and rename the php.ini-dist to the WINDOWS (C:\WINDOWS or C:\WINNT) folder. This file should be named php.ini (in other words remove the -dist).


STEP 4: Edit the php.ini and un-comment or add an extension=php_mssql70.dll (this calls the appropiate .dll from the SYSTEM path therefore this php_mssql70.dll must be in the SYSTEM folder. The php.ini must also call the correct name of the file (php_mssql70.dll) not php_mssql.dll). This entry is found in two places but must only be added to one or the other. (Windows Extensions and [MSSQL])


STEP 5: STOP ALL w3svc(s) including, especially the IIS Admin service. ('net stop iisadmin'). Then start the w3svc service which will also start the IIS Admin service.
HTH :)

Verwijderd

PHP:
1
2
3
<?
@mysql_select_db("$dbName"); 
?>
Die @ ervoor zal de waarschuwing onderdrukken, maar mysql_select_db() zal nog steeds niet uitgevoert worden...

En idd, zoals -X- zegt, je moet wel php zo "configureren" dat 'ie linkt met de mssql dll.

  • BierPul
  • Registratie: Juni 2001
  • Laatst online: 10:59

BierPul

2 koffie graag

Topicstarter
thnx guys het ging idd om de dll maar het is gefixed :9

Ja man

Pagina: 1