RE: [PHP] MS-SQL 7 versus MS-SQL 2000
| From: | Jay Blanchard | Date: | Wed, 08 May 2002 12:03:59 +0000 |
| Subject: | RE: [PHP] MS-SQL 7 versus MS-SQL 2000 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96575@lists.php.net to get a copy of this message | ||
[snip]
The problems have nothing to do with the fact that MS-SQL 7 - like MS-SQL
2000 - is not a real relational DBMS.
[/snip]
I am no M$ fan, but SQL Server is a REAL RDBMS. I don't know how you arrived
at this.
[snip]
Strangely enough, my problem seems to be with PHP.
It turns out that the code above is executed many times instead of just
once: the first time the
record is inserted successfully, but the script simply continues to insert
new records. If one of the fields in the table is unique, this means that
the second time the code is executed, the insertion fails, resulting in
mentioned error message. If there is no unique key in a table (or the
unique key is an AUTONUMBER or something), the record is inserted over and
over again until the script times out. This also happens if I do something
different than an insert, like a delete: the browser hangs for the maximum
execution time (30 seconds) and PHP times out. The same code is being
executed over and over again, deleting the same record over and over again
(which doesn't work, naturally).
- Apparantly, the POST-variables for the current page are saved and
passed on to the next page when I execute the header-function, so, in
effect, the script opens itself again.
{/snip]
It's not a PHP problem, it is a code problem. You need to rework your
class-method a little. If the method continues to loop (which it may be
doing with the other DB's as well, have you checked?) there is a problem
with how the method is implemented. Perhaps you should reset all
POST-variables after one trip through the system. Are you using sessions?
[snip]
The strange thing is: this seems to have nothing to do with the DBMS I'm
using, but with PHP instead. However I know that this isn't true, as the
code runs fine with different DBMS's!
[/snip]
I would check this carefully, because if it is as you say "- Apparantly, the
POST-variables for the current page are saved and passed on to the next page
when I execute the header-function, so, in effect, the script opens itself
again." It does not matter the DB unless you are trapping messages fromt he
RDBMS itself.
Jay