|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-02-06 05:50 UTC] john_woodhouse at hammond-logistics dot co dot uk
Evenin'...
This morning I decided to try PHP for our company web site instead of VBScript. Imagine my delight to find PHP will handle SQL7 with the minimum of fuss... all it would take was
<?php
$hostname = "[IPADDRESS],[PORT]";
$username = "[USER]";
$password = "[PWD]";
$dbName = "[DATABASENAME]";
MSSQL_CONNECT($hostname,$username,$password) or DIE("DATABASE FAILED TO RESPOND.");
mssql_select_db ( $dbName );
$query = "SELECT * FROM [TABLE]";
mssql_query ($query);
?>
Or even lazier
<?
MSSQL_CONNECT("[IPADDRESS],[PORT]","[USER]","[PWD]");
mssql_select_db ([DATABASENAME]);
mssql_query ("SELECT * FROM [TABLE]");
?>
Brilliant 15 lines of VBScript is 3 lines..
Imagine, then, my chagrin, for when I added the mssql_query(); statement I get a window saying PHP.EXE - Application Error.. The instruction at "0x00" referenced memory at "0x00", The memory could not be "read"...
Is it me???
The setup I used was the windows installer but I put php_mssql.dll into c:\PHP and told the php.ini file where it was.. I also stuck the ntwdblib.dll into c:\windows\system32... Yes I know it should be c:\winnt but I changed it at setup...
AAaaanyway...
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 23:00:01 2025 UTC |
Are you calling mssql_connect() this way or did I misunderstand it? mssql_connect("[localhost,123]", "[www]", "[secret]"); AFAIK, you should just call mssql_connect("localhost:123", "www", "secret"); Is that your problem? Anyway, it SHOULDN'T crash.Well it does... Tried your way MSSQL_CONNECT("HOST:123", "USER", "PWD"); got Warning: MS SQL: Unable to connect to server: HOST:123 in c:\inetpub\wwwroot\hello.php on line 5 Warning: MS SQL message: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. (severity 14) in c:\inetpub\wwwroot\hello.php on line 6 Warning: MS SQL: Unable to connect to server: (null) in c:\inetpub\wwwroot\hello.php on line 6 Warning: MS SQL: A link to the server could not be established in c:\inetpub\wwwroot\hello.php on line 6 Warning: MS SQL message: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. (severity 14) in c:\inetpub\wwwroot\hello.php on line 7 Warning: MS SQL: Unable to connect to server: (null) in c:\inetpub\wwwroot\hello.php on line 7 Warning: MS SQL: A link to the server could not be established in c:\inetpub\wwwroot\hello.php on line 7 Tried MSSQL_CONNECT("HOST,123", "USER", "PWD"); and it crashes... with error stated in first postingThe same problem. Win2K Pro, PHP 4.1.2 ===PHP.INI error_reporting= E_ALL; display all errors, warnings and notices enable_dl=on extension_dir=c:\php\extensions extension=php_mssql.dll === <?php $h = mssql_connect("nest.rtsnet.ru,1433", "wwwuser", "***"); mssql_select_db("WebInfo"); $rs = mssql_query("SELECT * FROM foo"); ?> Running from command line or as CGI results in the fatal application error. Any bug in query string results in normal PHP error message "MS SQL: Query failed in ....". ODBC version works ok.The crash occurs only if the query returns any records. The following example crashes on the last query. All others run fine (appropriate access rights assumed ;-) <? mssql_connect() or die ("Cannot open mssql\n"); @mssql_query("DROP DATABASE test"); mssql_query("CREATE DATABASE test") or die ("Cannot create database\n"); mssql_select_db ("test") or die ("Cannot select database\n"); mssql_query("CREATE TABLE foo (bar int)") or die ("Cannot create table\n"); mssql_query("INSERT INTO foo (bar) VALUES (1)") or die ("Cannot insert into table\n"); $res = mssql_query ("SELECT * FROM foo WHERE bar=2") or die ("DB error\n"); echo "Before crashing query\n"; $res = mssql_query ("SELECT * FROM foo") or die ("DB error\n"); ?> Using NT4 SP5 and tried with both PHP4.1.1 and 4.1.2