Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work ..updated..sorry
Fred Silsbee wrote: The following code doesn't do the insert. I've tried the insert statement in a session: [EMAIL PROTECTED] log_book]$ sqlplus landon/PW SQL*Plus: Release 11.1.0.6.0 - Production on Sat Nov 22 16:01:39 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL select * from log_book where actype='B-17'; no rows selected SQL quit Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options ?php // File: anyco.php require('anyco_ui.inc'); $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = LMKIIIGDNSID) ) ); if ($conn=oci_connect('landon', 'PWD',$db)) { echo Successfully connected to Oracle.\n; } else { $err = OCIError(); echo Oracle Connect Error . $err['message']; } $stid = oci_parse($conn, 'insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);'); $r = oci_execute($stid ); oci_commit($conn); OCILogoff($conn); echo end; ? produces: Successfully connected to Oracle.end This is my first php/oci8/oracle insert! What could be simpler! HELP! In desperation, I used em to give myself every possible privilege ! Not good but after it works, I can go back and correct and learn privileges! I rebooted and tried this again to no avail. I suspected a commit problem but oci_execute has commit as default! The table has no primary key defined since no values are unique. I have a similar table with a row id! One thing that jumps out at me is the insert query. You have: $stid = oci_parse($conn, 'insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);'); which will probably not do what you want. You probably mean to have the query in double quotes and the values in single quotes. $stid = oci_parse($conn, insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);); Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work ..updated..sorry
--- On Sun, 11/23/08, Jack van Zanen [EMAIL PROTECTED] wrote: From: Jack van Zanen [EMAIL PROTECTED] Subject: Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work ..updated..sorry To: [EMAIL PROTECTED] Date: Sunday, November 23, 2008, 7:04 AM HI of the top of my head, remove the semicolon from the sql string Brgds Jack 2008/11/23 Fred Silsbee [EMAIL PROTECTED] The following code doesn't do the insert. I've tried the insert statement in a session: [EMAIL PROTECTED] log_book]$ sqlplus landon/PW SQL*Plus: Release 11.1.0.6.0 - Production on Sat Nov 22 16:01:39 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL select * from log_book where actype='B-17'; no rows selected SQL quit Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options ?php // File: anyco.php require('anyco_ui.inc'); $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = LMKIIIGDNSID) ) ); if ($conn=oci_connect('landon', 'PWD',$db)) { echo Successfully connected to Oracle.\n; } else { $err = OCIError(); echo Oracle Connect Error . $err['message']; } $stid = oci_parse($conn, 'insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);'); $r = oci_execute($stid ); oci_commit($conn); OCILogoff($conn); echo end; ? produces: Successfully connected to Oracle.end This is my first php/oci8/oracle insert! What could be simpler! HELP! In desperation, I used em to give myself every possible privilege ! Not good but after it works, I can go back and correct and learn privileges! I rebooted and tried this again to no avail. I suspected a commit problem but oci_execute has commit as default! The table has no primary key defined since no values are unique. I have a similar table with a row id! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Thanks! I'll try that. Something strange happened yesterday! I ran the script via the browser and then brought up sqldeveloper! The table appeared NOT to be there until I closed the browser! This is worrisome! Logging in via sqlplus doesn't show the table busy I must remember the rules here to NOT top post! Forgive me if I forget once in a while! -- J.A. van Zanen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work ..updated..sorry
--- On Sun, 11/23/08, Jack van Zanen [EMAIL PROTECTED] wrote: From: Jack van Zanen [EMAIL PROTECTED] Subject: Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work ..updated..sorry To: [EMAIL PROTECTED] Date: Sunday, November 23, 2008, 7:09 AM a few things really I would stick the sql in a seperate variable that you can than echo to screen (debugging sql) Because I think your sql string does not go across properly unless you escape the single quotes you need to send across as single quotes. $sql='insert into log_book values ( TO_DATE(\'08/12/1973\',\'MM/dd/\'),\'B-17\',\'N5787G\',1,1.8)'; echo $sql; $stid = oci_parse($conn,$sql ); Jack 2008/11/23 Fred Silsbee [EMAIL PROTECTED] The following code doesn't do the insert. I've tried the insert statement in a session: [EMAIL PROTECTED] log_book]$ sqlplus landon/PW SQL*Plus: Release 11.1.0.6.0 - Production on Sat Nov 22 16:01:39 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL select * from log_book where actype='B-17'; no rows selected SQL quit Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options ?php // File: anyco.php require('anyco_ui.inc'); $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = LMKIIIGDNSID) ) ); if ($conn=oci_connect('landon', 'PWD',$db)) { echo Successfully connected to Oracle.\n; } else { $err = OCIError(); echo Oracle Connect Error . $err['message']; } $stid = oci_parse($conn, 'insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);'); $r = oci_execute($stid ); oci_commit($conn); OCILogoff($conn); echo end; ? produces: Successfully connected to Oracle.end This is my first php/oci8/oracle insert! What could be simpler! HELP! In desperation, I used em to give myself every possible privilege ! Not good but after it works, I can go back and correct and learn privileges! I rebooted and tried this again to no avail. I suspected a commit problem but oci_execute has commit as default! The table has no primary key defined since no values are unique. I have a similar table with a row id! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- J.A. van Zanen this is bad! good thing the script is simple thanks for your code I have 43 years of programming experience and you'd think I'd know better. This is however so simple (2 lines right out of the book) I expected it to work right out of the book! With this code, however, I do not even get the following: Successfully connected to Oracle. end This is however a great clue! Strange that yesterday I was running this and started sqldeveloper to find it showing the table NOT existing! I shut off the browser and bingo the table showed existing. It didn't show busy...but non existent! It happened again: It didn't show busy...but non existent! I shut off the browser and bingo the table showed existing. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work ..updated..sorry
--- On Sun, 11/23/08, Fred Silsbee [EMAIL PROTECTED] wrote: From: Fred Silsbee [EMAIL PROTECTED] Subject: Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work ..updated..sorry To: Jack van Zanen [EMAIL PROTECTED] Cc: php-db@lists.php.net Date: Sunday, November 23, 2008, 6:16 PM --- On Sun, 11/23/08, Jack van Zanen [EMAIL PROTECTED] wrote: From: Jack van Zanen [EMAIL PROTECTED] Subject: Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work ..updated..sorry To: [EMAIL PROTECTED] Date: Sunday, November 23, 2008, 7:09 AM a few things really I would stick the sql in a seperate variable that you can than echo to screen (debugging sql) Because I think your sql string does not go across properly unless you escape the single quotes you need to send across as single quotes. $sql='insert into log_book values ( TO_DATE(\'08/12/1973\',\'MM/dd/\'),\'B-17\',\'N5787G\',1,1.8)'; echo $sql; $stid = oci_parse($conn,$sql ); Jack 2008/11/23 Fred Silsbee [EMAIL PROTECTED] The following code doesn't do the insert. I've tried the insert statement in a session: [EMAIL PROTECTED] log_book]$ sqlplus landon/PW SQL*Plus: Release 11.1.0.6.0 - Production on Sat Nov 22 16:01:39 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL select * from log_book where actype='B-17'; no rows selected SQL quit Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options ?php // File: anyco.php require('anyco_ui.inc'); $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = LMKIIIGDNSID) ) ); if ($conn=oci_connect('landon', 'PWD',$db)) { echo Successfully connected to Oracle.\n; } else { $err = OCIError(); echo Oracle Connect Error . $err['message']; } $stid = oci_parse($conn, 'insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);'); $r = oci_execute($stid ); oci_commit($conn); OCILogoff($conn); echo end; ? produces: Successfully connected to Oracle.end This is my first php/oci8/oracle insert! What could be simpler! HELP! In desperation, I used em to give myself every possible privilege ! Not good but after it works, I can go back and correct and learn privileges! I rebooted and tried this again to no avail. I suspected a commit problem but oci_execute has commit as default! The table has no primary key defined since no values are unique. I have a similar table with a row id! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- J.A. van Zanen this is bad! good thing the script is simple thanks for your code I have 43 years of programming experience and you'd think I'd know better. This is however so simple (2 lines right out of the book) I expected it to work right out of the book! With this code, however, I do not even get the following: Successfully connected to Oracle. end This is however a great clue! Strange that yesterday I was running this and started sqldeveloper to find it showing the table NOT existing! I shut off the browser and bingo the table showed existing. It didn't show busy...but non existent! It happened again: It didn't show busy...but non existent! I shut off the browser and bingo the table showed existing. BINGO! It was the ; at the end of the select staement! this works: ?php // File: anyco.php $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = LMKIIIGDNSID) ) ); // oci_internal_debug(1); if ($conn=oci_connect('landon', 'rumprocella',$db)) { print Successfully connected to Oracle.\n\n; // OCILogoff($conn); } else { $err = OCIError(); echo Oracle Connect Error . $err['message']; } $stid = oci_parse($conn, insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8)); $r = oci_execute($stid ); oci_commit($conn); OCILogoff($conn); echo end; ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work ..updated..sorry
--- On Sun, 11/23/08, Micah Gersten [EMAIL PROTECTED] wrote: From: Micah Gersten [EMAIL PROTECTED] Subject: Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work ..updated..sorry To: [EMAIL PROTECTED] Cc: php-db@lists.php.net Date: Sunday, November 23, 2008, 9:26 AM Fred Silsbee wrote: The following code doesn't do the insert. I've tried the insert statement in a session: [EMAIL PROTECTED] log_book]$ sqlplus landon/PW SQL*Plus: Release 11.1.0.6.0 - Production on Sat Nov 22 16:01:39 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL select * from log_book where actype='B-17'; no rows selected SQL quit Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options ?php // File: anyco.php require('anyco_ui.inc'); $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = LMKIIIGDNSID) ) ); if ($conn=oci_connect('landon', 'PWD',$db)) { echo Successfully connected to Oracle.\n; } else { $err = OCIError(); echo Oracle Connect Error . $err['message']; } $stid = oci_parse($conn, 'insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);'); $r = oci_execute($stid ); oci_commit($conn); OCILogoff($conn); echo end; ? produces: Successfully connected to Oracle.end This is my first php/oci8/oracle insert! What could be simpler! HELP! In desperation, I used em to give myself every possible privilege ! Not good but after it works, I can go back and correct and learn privileges! I rebooted and tried this again to no avail. I suspected a commit problem but oci_execute has commit as default! The table has no primary key defined since no values are unique. I have a similar table with a row id! One thing that jumps out at me is the insert query. You have: $stid = oci_parse($conn, 'insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);'); which will probably not do what you want. You probably mean to have the query in double quotes and the values in single quotes. $stid = oci_parse($conn, insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);); Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com ..Thanks! turned out it was the blasted; at the end of the select statement the following works GREAT: ?php // File: $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = LMKIIIGDNSID) ) ); // oci_internal_debug(1); if ($conn=oci_connect('landon', 'rumprocella',$db)) { print Successfully connected to Oracle.\n\n; // OCILogoff($conn); } else { $err = OCIError(); echo Oracle Connect Error . $err['message']; } $stid = oci_parse($conn, insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8)); $r = oci_execute($stid ); oci_commit($conn); OCILogoff($conn); echo end; ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work ..updated..sorry
--- On Sun, 11/23/08, Fred Silsbee [EMAIL PROTECTED] wrote: From: Fred Silsbee [EMAIL PROTECTED] Subject: Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work ..updated..sorry To: Jack van Zanen [EMAIL PROTECTED] Cc: php-db@lists.php.net Date: Sunday, November 23, 2008, 6:16 PM --- On Sun, 11/23/08, Jack van Zanen [EMAIL PROTECTED] wrote: From: Jack van Zanen [EMAIL PROTECTED] Subject: Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work ..updated..sorry To: [EMAIL PROTECTED] Date: Sunday, November 23, 2008, 7:09 AM a few things really I would stick the sql in a seperate variable that you can than echo to screen (debugging sql) Because I think your sql string does not go across properly unless you escape the single quotes you need to send across as single quotes. $sql='insert into log_book values ( TO_DATE(\'08/12/1973\',\'MM/dd/\'),\'B-17\',\'N5787G\',1,1.8)'; echo $sql; $stid = oci_parse($conn,$sql ); Jack 2008/11/23 Fred Silsbee [EMAIL PROTECTED] The following code doesn't do the insert. I've tried the insert statement in a session: [EMAIL PROTECTED] log_book]$ sqlplus landon/PW SQL*Plus: Release 11.1.0.6.0 - Production on Sat Nov 22 16:01:39 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL select * from log_book where actype='B-17'; no rows selected SQL quit Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options ?php // File: anyco.php require('anyco_ui.inc'); $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = LMKIIIGDNSID) ) ); if ($conn=oci_connect('landon', 'PWD',$db)) { echo Successfully connected to Oracle.\n; } else { $err = OCIError(); echo Oracle Connect Error . $err['message']; } $stid = oci_parse($conn, 'insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);'); $r = oci_execute($stid ); oci_commit($conn); OCILogoff($conn); echo end; ? produces: Successfully connected to Oracle.end This is my first php/oci8/oracle insert! What could be simpler! HELP! In desperation, I used em to give myself every possible privilege ! Not good but after it works, I can go back and correct and learn privileges! I rebooted and tried this again to no avail. I suspected a commit problem but oci_execute has commit as default! The table has no primary key defined since no values are unique. I have a similar table with a row id! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- J.A. van Zanen this is bad! good thing the script is simple thanks for your code I have 43 years of programming experience and you'd think I'd know better. This is however so simple (2 lines right out of the book) I expected it to work right out of the book! With this code, however, I do not even get the following: Successfully connected to Oracle. end This is however a great clue! Strange that yesterday I was running this and started sqldeveloper to find it showing the table NOT existing! I shut off the browser and bingo the table showed existing. It didn't show busy...but non existent! It happened again: It didn't show busy...but non existent! I shut off the browser and bingo the table showed existing. the last problem (whew!): you mentioned this- THANKS $stid = oci_parse($conn, 'insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8)'); should be changed to : $stid = oci_parse($conn, insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8)); in other places this makes no difference -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work
Fred Silsbee wrote: The following code doesn't do the insert. As is the connect message doesn't show. I've tried the insert statement in a session: [EMAIL PROTECTED] log_book]$ sqlplus landon/rumprocella SQL*Plus: Release 11.1.0.6.0 - Production on Sat Nov 22 16:01:39 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL select * from log_book where actype='B-17'; no rows selected SQL quit Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options ?php // File: anyco.php require('anyco_ui.inc'); $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = LMKIIIGDNSID) ) ); if ($conn=oci_connect('landon', 'rumprocella',$db)) { echo Successfully connected to Oracle.\n; // OCILogoff($conn); } else { $err = OCIError(); echo Oracle Connect Error . $err['message']; } // the connect shows a connect if I comment out the following statements $stid = oci_parse($conn, 'insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);'); $r = oci_execute($stid ); RTFM. $err = OCIError($r); echo Oracle insert error . $err['message']; -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work
Fred Silsbee wrote: --- On Sun, 11/23/08, Chris [EMAIL PROTECTED] wrote: From: Chris [EMAIL PROTECTED] Subject: Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work To: [EMAIL PROTECTED] Cc: php-db@lists.php.net Date: Sunday, November 23, 2008, 9:43 PM Fred Silsbee wrote: The following code doesn't do the insert. As is the connect message doesn't show. I've tried the insert statement in a session: [EMAIL PROTECTED] log_book]$ sqlplus landon/rumprocella SQL*Plus: Release 11.1.0.6.0 - Production on Sat Nov 22 16:01:39 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL select * from log_book where actype='B-17'; no rows selected SQL quit Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options ?php // File: anyco.php require('anyco_ui.inc'); $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = LMKIIIGDNSID) ) ); if ($conn=oci_connect('landon', 'rumprocella',$db)) { echo Successfully connected to Oracle.\n; // OCILogoff($conn); } else { $err = OCIError(); echo Oracle Connect Error . $err['message']; } // the connect shows a connect if I comment out the following statements $stid = oci_parse($conn, 'insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);'); $r = oci_execute($stid ); RTFM. $err = OCIError($r); echo Oracle insert error . $err['message']; -- Postgresql php tutorials http://www.designmagick.com/ the code works now is the question why is there no display in the browser when the sql is bad? Because you had a parse error and you most likely have all display_errors and other such useful things turned off. Save this code to a file. From the command line run: php -l filename.php (that's an L not a one). You will see: $ php -l test.php Parse error: syntax error, unexpected T_LNUMBER in test.php on line 21 Errors parsing test.php -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work
--- On Sun, 11/23/08, Chris [EMAIL PROTECTED] wrote: From: Chris [EMAIL PROTECTED] Subject: Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work To: [EMAIL PROTECTED], PHP DB php-db@lists.php.net Date: Sunday, November 23, 2008, 10:41 PM Fred Silsbee wrote: --- On Sun, 11/23/08, Chris [EMAIL PROTECTED] wrote: From: Chris [EMAIL PROTECTED] Subject: Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work To: [EMAIL PROTECTED] Cc: php-db@lists.php.net Date: Sunday, November 23, 2008, 9:43 PM Fred Silsbee wrote: The following code doesn't do the insert. As is the connect message doesn't show. I've tried the insert statement in a session: [EMAIL PROTECTED] log_book]$ sqlplus landon/rumprocella SQL*Plus: Release 11.1.0.6.0 - Production on Sat Nov 22 16:01:39 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL select * from log_book where actype='B-17'; no rows selected SQL quit Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options ?php // File: anyco.php require('anyco_ui.inc'); $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = LMKIIIGDNSID) ) ); if ($conn=oci_connect('landon', 'rumprocella',$db)) { echo Successfully connected to Oracle.\n; // OCILogoff($conn); } else { $err = OCIError(); echo Oracle Connect Error . $err['message']; } // the connect shows a connect if I comment out the following statements $stid = oci_parse($conn, 'insert into log_book values ( TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);'); $r = oci_execute($stid ); RTFM. $err = OCIError($r); echo Oracle insert error . $err['message']; -- Postgresql php tutorials http://www.designmagick.com/ the code works now is the question why is there no display in the browser when the sql is bad? Because you had a parse error and you most likely have all display_errors and other such useful things turned off. Save this code to a file. From the command line run: php -l filename.php (that's an L not a one). You will see: $ php -l test.php Parse error: syntax error, unexpected T_LNUMBER in test.php on line 21 Errors parsing test.php -- I put back errors on purpose to teach myself how to handle errors! I looked in the book and corrected my code to no avail! ?php // File: anyco.php $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = LMKIIIGDNSID) ) ); if ($conn=oci_connect('landon', 'rumprocella',$db)) { echo Successfully connected to Oracle.\n; // OCILogoff($conn); } else { $err = OCIError(); echo Oracle Connect Error . $err; } // $stid = oci_parse($conn, insert into log_book_id values (logid.nextval, TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8)); // has errors $stid = oci_parse($conn, 'insert into log_book_id values (logid.nextval, TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);'); if (!$stid) { $oerr = OCIError($conn); var_dump($oerr); echo Parse error:.$oerr; exit; } $r = oci_execute($stid ); if (!$r) { $oerr = OCIError($stid); echo Exec error:.$oerr; var_dump($oerr); exit; } oci_commit($conn); OCILogoff($conn); echo end; ? still no browser output I did the command you suggested: [EMAIL PROTECTED] html]# php -l try_logid.php PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/php_oci8.dll' - /usr/lib/php/modules/php_oci8.dll: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/php_oracle.dll' - /usr/lib/php/modules/php_oracle.dll: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Parse error: syntax error, unexpected T_LNUMBER in try_logid.php on line 21 Errors parsing try_logid.php the route I traveled: install 11g1 install pecl and phize in Fedora install oci8 (according to your great instructions) apache already installed then I had to add environment variables to httpd and httpd.conf -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work
PHP Parse error: syntax error, unexpected T_LNUMBER in try_logid.php on line 21 Errors parsing try_logid.php You have a parse error. PHP cannot work out what to do in the file. It's a fatal error. It's because on line 21 (like the message says) you are using single quotes for in out of the sql statement (not what the message says). ?php $string = 'in and 'out'; will give the same error. Inside quotes, you have to escape quotes of the same type. $string = 'in and \'out'; or $string = in and \out; or $string = in and 'out; -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php