Re: mssql functions not working properly

From: Date: Fri, 26 Jul 2002 05:09:31 +0000
Subject: Re: mssql functions not working properly
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-14959@lists.php.net to get a copy of this message
I have the same type of setup and am having the same problems you are having. I can't get the following to work: $result=mssql_query($sql) or die('message'); It dies even when the query is successful and I've parsed it in QA. Instead this is working for me (somewhat): $result=mssql_query($sql1); $result=mssql_query("SELECT @@ERROR As 'ErrorCode'"); $error=mssql_result($result,0,0); if($error['ErrorCode'] != 0) { echo $error['ErrorCode']; echo $sql1; die('Inserting Campaign failed'); } This will plug along fine until all of the sudden tons of warnings pop up and I have to bounce IIS to get it going correctly again. I haven't figured out whats going on yet but I just re-applied SP2 to the Win2k server running IIS and am crossing my fingers. Salve "David Elliott" <list@elliott.uk.com> wrote in message news:140141727663.20020722085937@elliott.uk.com... > Greetings All, > > I posted this on Friday but now I have cut it down to make it readable and > stand alone > > W2K server > MS SQL 2000 > PHP 4.2.1 (in CGI mode) > > I have a valid bit of SQL, but PHP does not correctly run it > > below is bit of code > > ==========8<============================================================= > <? > define("Server","xxxxxxxxx"); > define("User","xxxxxx"); > define("PWord","xxxxxx"); > > mssql_connect(Server,User,PWord); > > $ExcQry = " > begin transaction > set nocount on > declare > @PerID int > > insert into > Item (ItemTypeid,Name,LastUpdated,LegacyId) > Values(42,'CCompanyName',Current_timestamp,'".date > ("mdGis")."') > > set @PerId = @@identity > > insert into > person > (ItemId,CompanyName,FirstName,LastName) > Values > (@PerId,'PCompanyName','PFirstName','PLastName') > > set nocount off > > commit > > select @PerId itemid > > "; > $Result = mssql_query($ExcQry); > > list($ItemId)=mssql_fetch_row($Result); > > echo $ItenId; > > ==========8<============================================================= > > The code does get passes and run as there are results in the database, but I > get no result set back. I have also run it in the query analyser, it runs. I > have also watched it in the profiler and seen it work. > > -- > BBFN, _______________________________________________ > David | David Elliott | Software Engineer | > _________________________| list@elliott.uk.com | PGP Key ID 0x650F4534 | > | Don't be a baby. I know what I'm doing. --Wednesday. | >

« previous php.windows (#14959) next »