php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20826 update statement in mssql_query causes Access Violation
Submitted: 2002-12-05 07:12 UTC Modified: 2002-12-05 10:59 UTC
From: pyfra at web dot de Assigned:
Status: Closed Package: MSSQL related
PHP Version: 4.3.0RC2 OS: Windows 2000 Server
Private report: No CVE-ID: None
 [2002-12-05 07:12 UTC] pyfra at web dot de
Since I upgraded from 4.23 to 4.3.0RC2 PHP is causing a lot of SQL-trouble. We are using MS SQL-Server 2000/IIS/Win2000Server/PHP4.3.0-ORC2(isapi). 

The trouble mainly is caused by using the UPDATE statement. Example: 

	$statement = "
UPDATE table1 
SET name1 = 'anything' 
WHERE name1 = 'something'
	";
	mssql_query($statement,$dbh);

Returns 'PHP has encountered an Access Violation at 01A95154' in the browser window but the PHP-script dows not execute anything after the query. 
Strange enough a check of the database shows the query itself being successful. 

If I now replace 
	mssql_query($statement,$dbh);
with 
	$var = mssql_query($statement,$dbh);
the script continues working and everything seems to be ok. 

But having an update statement in a loop you will have to change the name of the variable (called $var above), otherwise this fails after the first loop. 
Further problems occuring with mssql-queries in selfdefined functions ... the above workaround seems not to work in functions.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-05 08:44 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip
 [2002-12-05 10:17 UTC] pyfra at web dot de
Thank you very much! Whatever the reason was, the problem seems to have disappeared after update to 4.4.0-dev. :-)
 [2002-12-05 10:59 UTC] sniper@php.net
Closing then. The fix was also merged to the STABLE branch so it will be in 4.3.0 too.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC