By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,967 Members | 1,687 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,967 IT Pros & Developers. It's quick & easy.

Problem with mssql driver

P: n/a
Hello,
I have a strange problem while using mssql server driver:
when i update/insert in/delete a table and want to redirect after, i have
the following error message:

CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:

The strange thing is that if i do a select or use mysql driver (with select,
insert, delete or update) i have no problem. Also if i update a none
existant row (ie usId = -1) there is no problem.
Here is a sample code that produce the error :

<?php
$conn = mssql_connect($server, $user, $password);
mssql_select_db($db);
$result = mssql_query("UPDATE Users SET usFirstName = 'Guillaume' WHERE usId
= 20");
mssql_close();

header("Location: $redirect");
exit();
?>

When i call this page, the database is updated and my browser goes to the
$redirect page but displays the aboved error message instead of the page.

System infos:
os : windows 2k server sp3
web: iis 5.0
php: 4.3.2
db : sql server 2000 entreprise sp2

Anyone knows the cause of this problem and/or how to resolve it ?

Thanks,
Guillaume


Jul 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Guillaume!

On Sun, 24 Aug 2003 10:38:30 +0200, "Guillaume"
<no**********************@free.fr> wrote:
Hello,
I have a strange problem while using mssql server driver:
when i update/insert in/delete a table and want to redirect after, i have
the following error message:

What is the output of

mssql_error() and error_reporting(E_ALL); before the redirect? Most
probably there is a problem with your query.

When you then redirect, the server thinks the error messages are part
of the HTTP headers.

HTH, Jochen
--
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 16 '05 #2

P: n/a
Hi Jochen,
There is no mssql_error() function but i found this function in the doc :

mssql_get_last_message -- Returns the last message from server

This function returns the string "Changed database context to 'Agenda'."
which is the message generated by the mssql_select_db() function. So there
is no error during the update (i also tested the return value of
mssql_query() and it isn t FALSE).
The error_reporting(E_ALL); function doesn t change anything (no error
reported).
I also sets theis 2 functions :

mssql_min_error_severity(0)
mssql_min_message_severity(0)

So i have all mssql messages but there is none.

Guillaume

"Jochen Daum" <jd@jdaum.de> wrote in message
news:v8********************************@4ax.com...
Hi Guillaume!

On Sun, 24 Aug 2003 10:38:30 +0200, "Guillaume"
<no**********************@free.fr> wrote:
Hello,
I have a strange problem while using mssql server driver:
when i update/insert in/delete a table and want to redirect after, i have
the following error message:

What is the output of

mssql_error() and error_reporting(E_ALL); before the redirect? Most
probably there is a problem with your query.

When you then redirect, the server thinks the error messages are part
of the HTTP headers.

HTH, Jochen
--
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/

Jul 16 '05 #3

P: n/a
Hi Guillaume!

On Sun, 24 Aug 2003 11:14:30 +0200, "Guillaume"
<no**********************@free.fr> wrote:
Hi Jochen,
There is no mssql_error() function but i found this function in the doc :

mssql_get_last_message -- Returns the last message from server
Right. I have to look up everything on www.php.net
This function returns the string "Changed database context to 'Agenda'."
which is the message generated by the mssql_select_db() function. So there
is no error during the update (i also tested the return value of
mssql_query() and it isn t FALSE).
The error_reporting(E_ALL); function doesn t change anything (no error
reported).
I also sets theis 2 functions :

mssql_min_error_severity(0)
mssql_min_message_severity(0)

So i have all mssql messages but there is none.
What about a var_dump of the resource you get with mssql_open_db();?

HTH, Jochen
Guillaume

"Jochen Daum" <jd@jdaum.de> wrote in message
news:v8********************************@4ax.com.. .
Hi Guillaume!

On Sun, 24 Aug 2003 10:38:30 +0200, "Guillaume"
<no**********************@free.fr> wrote:
>Hello,
>I have a strange problem while using mssql server driver:
>when i update/insert in/delete a table and want to redirect after, i have
>the following error message:
>

What is the output of

mssql_error() and error_reporting(E_ALL); before the redirect? Most
probably there is a problem with your query.

When you then redirect, the server thinks the error messages are part
of the HTTP headers.

HTH, Jochen
--
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/


--
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.