ID: 11819 Updated by: derick Reported By: [EMAIL PROTECTED] Old-Status: Open Status: Bogus Bug Type: InterBase related Operating system: PHP Version: 4.0.5 Assigned To: Comments: This is not a PHP bug. Interbase gives you a warning, and not PHP. (PHP merely shows the warning for you). Derick Previous Comments: --------------------------------------------------------------------------- [2001-07-01 04:03:50] [EMAIL PROTECTED] Environment: - Windows 2000 Server - Apache v1.3.20 (binaries from www.apache.org) - PHP v4.0.5 (binaries from www.php.net) - InterBase v6.0.0.627 (binaries from www.borland.com) 1. Create very simple database: ----------------------------------------------------------------- CREATE DATABASE 'c:dbtest.gdb' USER 'user' PASSWORD 'password'; CREATE TABLE TABLE_1 ( ID_1 INTEGER NOT NULL); CREATE TABLE TABLE_2 ( ID_2 INTEGER NOT NULL, FK INTEGER); ALTER TABLE TABLE_1 ADD CONSTRAINT PK_1 PRIMARY KEY (ID_1); ALTER TABLE TABLE_2 ADD CONSTRAINT PK_2 PRIMARY KEY (ID_2); ALTER TABLE TABLE_2 ADD CONSTRAINT FK_2_1 FOREIGN KEY (FK) REFERENCES TABLE_1 (ID_1); COMMIT WORK; ----------------------------------------------------------------- 2. Create very simple PHP script: ----------------------------------------------------------------- <?php $ib = ibase_connect('c:dbtest.gdb','user','password'); $query = ibase_prepare($ib,'insert into TABLE_2(ID_2, FK) values (?, ?)'); $rs = ibase_execute($query,1,null); ibase_close($ib); ?> ----------------------------------------------------------------- 3. Run it and look at the following error: ----------------------------------------------------------------- Warning: InterBase: violation of FOREIGN KEY constraint "FK_2_1" on table "TABLE_2" in test.php on line 5 ----------------------------------------------------------------- Note, that if we'll insert non-NULL value into TABLE_2.FK, then all will work fine. 4. Rewire our PHP script slightly: ----------------------------------------------------------------- <?php $ib = ibase_connect('c:dbtest.gdb','user','password'); $query = ibase_query($ib,"insert into TABLE_2(ID_2, FK) values (1,null)"); ibase_close($ib); ?> ----------------------------------------------------------------- 5. Run it and note, that all works fine! So, there is a serious bug into ibase_execute() function, which prevents first version of PHP script from working properly. --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=11819&edit=2 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]