ID: 38870
Updated by: [EMAIL PROTECTED]
Reported By: howardt at calhounisd dot org
-Status: Closed
+Status: Bogus
Bug Type: MSSQL related
Operating System: Windows XP, Windows Server 2000
PHP Version: 4.4.4
Previous Comments:
------------------------------------------------------------------------
[2006-09-19 13:24:41] howardt at calhounisd dot org
var_dump gives me "resource(16) of type (mssql result)", which is what
I would expect. I did a lot of research last night and this morning,
and I found that the original programmer wrote internal error-handling
steps embedded deep within another script, and these were causing the
problem. I have been able to work around these, and now the INSERT
command works fine. I guess the bottom line is: be VERY careful when
working on somebody else's code! Thanks for all your help!!!
------------------------------------------------------------------------
[2006-09-18 20:45:21] phpbugs at thequod dot de
Try
var_dump($Insert_Result);
after executing the query (and remove the "or die()"
therefor, of course).
What does it result in?
------------------------------------------------------------------------
[2006-09-18 20:40:11] howardt at calhounisd dot org
I set the display_errors and error_reporting as directed, restarted the
service (in IIS), and I could not get an error message to display. I
also tried setting track_errors=on and then referencing $php_errormsg,
but still got nothing.
------------------------------------------------------------------------
[2006-09-18 17:54:51] [EMAIL PROTECTED]
Set display_errors to On, error_reporting to E_ALL and restart the
webserver.
Please post the error message you get after that.
------------------------------------------------------------------------
[2006-09-18 17:36:45] howardt at calhounisd dot org
Description:
------------
When running an INSERT command through MSSQL_Query, the transaction is
successful (the record is inserted) but the script immediately dies
("OR die(...)" is executed). I have followed what documentation I can
find on the PHP site, but it dies every time. This does not occur on
SELECT or UPDATE commands.
Reproduce code:
---------------
<?
$MSSQL_Link = MSSQL_Connect($DistrictServer, "UserID", "password");
MSSQL_Select_DB($DistrictServerDB, $MSSQL_Link);
$Insert_Query = "INSERT INTO table(SchoolID, StateID)
VALUES('$StudentNum', '$stateid')";
$Insert_Result = MSSQL_Query($Insert_Query, $MSSQL_Link) OR die("Could
not insert record. " . $Insert_Query);
echo "Success";
?>
Expected result:
----------------
"Success" should be displayed on the page.
Actual result:
--------------
"Could not insert record. INSERT INTO table(SchoolID, StateID)
VALUES('123456', '987654')" is displayed instead.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38870&edit=1