Re: [PHP-DB] works under mysql 5 but not under Oracle 11g1
--- On Mon, 11/24/08, Chris [EMAIL PROTECTED] wrote: From: Chris [EMAIL PROTECTED] Subject: Re: [PHP-DB] works under mysql 5 but not under Oracle 11g1 To: [EMAIL PROTECTED] Cc: php-db@lists.php.net Date: Monday, November 24, 2008, 6:41 AM Fred Silsbee wrote: while ($newArray = oci_fetch_assoc($result)) { foreach ($fields as $field){ ${$field} = $newArray[$field];// values not making it into variable } print_r($newArray); what is here? Oracle uppercases all fields, tablenames by default (per sql spec). -- Postgresql php tutorials http://www.designmagick.com/ I am new to PHP and I was wondering if an array can contain dissimilar types while ($newArray = oci_fetch_assoc($result)) { surely a DB row might contain : create table log_book_id ( log_id number primary key, fdate date, actype varchar2(16), acid varchar(16), nlandings number, nhours number); insert into log_book_id values (logid.nextval, TO_DATE('08/12/1973','MM/dd/'),'C150','N5787G',1,1.8); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] works under mysql 5 but not under Oracle 11g1
--- On Mon, 11/24/08, Chris [EMAIL PROTECTED] wrote: From: Chris [EMAIL PROTECTED] Subject: Re: [PHP-DB] works under mysql 5 but not under Oracle 11g1 To: [EMAIL PROTECTED] Cc: php-db@lists.php.net Date: Monday, November 24, 2008, 6:41 AM Fred Silsbee wrote: while ($newArray = oci_fetch_assoc($result)) { foreach ($fields as $field){ ${$field} = $newArray[$field];// values not making it into variable } print_r($newArray); what is here? Oracle uppercases all fields, tablenames by default (per sql spec). -- Postgresql php tutorials http://www.designmagick.com/ here is the whole thing: ?php $db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = LMKIIIGDNSID) ) ); // oci_internal_debug(1); // turn on tracing // $conn = oci_connect(/, , null, null, OCI_SYSDBA); // if ($conn=oci_connect('hr', 'hr','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']; } //construct a global variable for the form profile $fields = array(fdate, actype, acid, nlandings, nhours); /// // If the submit button has been pressed if (isset($_POST['select'])){ displayDeleteForm(); }elseif(isset($_POST['delete'])){ deleteRecords(); } elseif(isset($_POST['insert'])){ insertRecord(); } elseif (isset($_POST['new'])){ displayEntryForm(); } else { //default action displayEntryForm(); } function displayDeleteForm(){ //get $fields into the function namespace global $fields; global $conn; /* Create and execute query. */ // $query = select * from log_book_id; // $result = mysql_query($query); // Loop through each row, outputting the actype and name echo HTML Pilots Logbook entries stored in mySQL Relational Database under Redhat Fedora 8 Linux form action={$_SERVER['PHP_SELF']} method=post
Re: [PHP-DB] works under mysql 5 but not under Oracle 11g1
--- On Mon, 11/24/08, Chris [EMAIL PROTECTED] wrote: From: Chris [EMAIL PROTECTED] Subject: Re: [PHP-DB] works under mysql 5 but not under Oracle 11g1 To: [EMAIL PROTECTED] Cc: php-db@lists.php.net Date: Monday, November 24, 2008, 6:41 AM Fred Silsbee wrote: while ($newArray = oci_fetch_assoc($result)) { foreach ($fields as $field){ ${$field} = $newArray[$field];// values not making it into variable } print_r($newArray); what is here? Oracle uppercases all fields, tablenames by default (per sql spec). -- Postgresql php tutorials http://www.designmagick.com/ That code showed all...THANKS! The data is being extracted but not making it to the variables. while ($newArray = oci_fetch_assoc($result)) { print_r($newArray); // everything!!! is there foreach ($fields as $field){ ${$field} = $newArray[$field];// here...works under MySQL } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] works under mysql 5 but not under Oracle 11g1
--- On Mon, 11/24/08, Fred Silsbee [EMAIL PROTECTED] wrote: From: Fred Silsbee [EMAIL PROTECTED] Subject: Re: [PHP-DB] works under mysql 5 but not under Oracle 11g1 To: Chris [EMAIL PROTECTED] Cc: php-db@lists.php.net Date: Monday, November 24, 2008, 2:44 PM --- On Mon, 11/24/08, Chris [EMAIL PROTECTED] wrote: From: Chris [EMAIL PROTECTED] Subject: Re: [PHP-DB] works under mysql 5 but not under Oracle 11g1 To: [EMAIL PROTECTED] Cc: php-db@lists.php.net Date: Monday, November 24, 2008, 6:41 AM Fred Silsbee wrote: while ($newArray = oci_fetch_assoc($result)) { foreach ($fields as $field){ ${$field} = $newArray[$field];// values not making it into variable } print_r($newArray); what is here? Oracle uppercases all fields, tablenames by default (per sql spec). -- Postgresql php tutorials http://www.designmagick.com/ That code showed all...THANKS! The data is being extracted but not making it to the variables. while ($newArray = oci_fetch_assoc($result)) { print_r($newArray); // everything!!! is there foreach ($fields as $field){ ${$field} = $newArray[$field];// here...works under MySQL } fixed the problem but am not fully sure of the optimum code one should use! I like the association idea but must change the $fields array There is a better way than using count! 67 //get log_book_id table information 68 $user = select * from log_book_id; 69 $result = oci_parse($conn, $user); 70 $r = oci_execute($result); 71 72 //display log_book_id information 73 74 while ($newArray = oci_fetch_row($result)) { 75 // print_r($newArray); 76 $count = 1; 77 foreach ($fields as $field){ 78 ${$field} = $newArray[$count]; 79 $count = $count +1; 80 // print_r(${$field}); 81 // print_r($newArray[$field]); 82 } 83 $rowID = $newArray[0]; 84 85 //note that we do not rely on the checkbox value as not all browsers submit it 86 //instead we rely on the name of the checkbox. 87 echo HTML 88 TR 89 td 90 input type=checkbox name=checkbox[$rowID] value=$rowIDCheck to delete record 91 /td 92 TD$rowID/TD 93 TD$fdate/TD 94 TD$actype/TD 95 TD$acid/TD 96 TD$nlandings/TD 97 TD$nhours/TD 98 /TR -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] works under mysql 5 but not under Oracle 11g1
fixed the problem but am not fully sure of the optimum code one should use! I like the association idea but must change the $fields array There is a better way than using count! 67 //get log_book_id table information 68 $user = select * from log_book_id; 69 $result = oci_parse($conn, $user); 70 $r = oci_execute($result); 71 72 //display log_book_id information 73 74 while ($newArray = oci_fetch_row($result)) { 75 // print_r($newArray); What does line 75 show and what do you expect it to show? 85 //note that we do not rely on the checkbox value as not all browsers submit it 86 //instead we rely on the name of the checkbox. Well, that's wrong. The value is submitted IF the checkbox is ticked. If it is not ticked, it is not submitted (this is the same in any language, it's not a php specific thing). -- 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] works under mysql 5 but not under Oracle 11g1
--- On Mon, 11/24/08, Chris [EMAIL PROTECTED] wrote: From: Chris [EMAIL PROTECTED] Subject: Re: [PHP-DB] works under mysql 5 but not under Oracle 11g1 To: [EMAIL PROTECTED] Cc: php-db@lists.php.net Date: Monday, November 24, 2008, 10:00 PM fixed the problem but am not fully sure of the optimum code one should use! I like the association idea but must change the $fields array There is a better way than using count! 67 //get log_book_id table information 68 $user = select * from log_book_id; 69 $result = oci_parse($conn, $user); 70 $r = oci_execute($result); 71 72 //display log_book_id information 73 74 while ($newArray = oci_fetch_row($result)) { 75 // print_r($newArray); What does line 75 show and what do you expect it to show? 85 //note that we do not rely on the checkbox value as not all browsers submit it 86 //instead we rely on the name of the checkbox. Well, that's wrong. The value is submitted IF the checkbox is ticked. If it is not ticked, it is not submitted (this is the same in any language, it's not a php specific thing). -- Postgresql php tutorials http://www.designmagick.com/ Array ( [LOG_ID] = 405 [FDATE] = 15-JUL-01 [ACTYPE] = C172 [ACID] = N17SJ [NLANDINGS] = 1 [NHOURS] = 1.2 ) thanks for the print_r tip! I need to fix ${$field} = $newArray[$field]; ?? i need to properly use the association I have seen no mention of the syntax ${$field} even though it looks reasonable! I have two 900 pages books on MySQL and PHP 5 one is 2 years old and the other is 2 years old The check mark doesn't come into play until delete rows is selected. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] works under mysql 5 but not under Oracle 11g1
--- On Mon, 11/24/08, Fred Silsbee [EMAIL PROTECTED] wrote: From: Fred Silsbee [EMAIL PROTECTED] Subject: Re: [PHP-DB] works under mysql 5 but not under Oracle 11g1 To: Chris [EMAIL PROTECTED] Cc: php-db@lists.php.net Date: Monday, November 24, 2008, 10:31 PM --- On Mon, 11/24/08, Chris [EMAIL PROTECTED] wrote: From: Chris [EMAIL PROTECTED] Subject: Re: [PHP-DB] works under mysql 5 but not under Oracle 11g1 To: [EMAIL PROTECTED] Cc: php-db@lists.php.net Date: Monday, November 24, 2008, 10:00 PM fixed the problem but am not fully sure of the optimum code one should use! I like the association idea but must change the $fields array There is a better way than using count! 67 //get log_book_id table information 68 $user = select * from log_book_id; 69 $result = oci_parse($conn, $user); 70 $r = oci_execute($result); 71 72 //display log_book_id information 73 74 while ($newArray = oci_fetch_row($result)) { 75 // print_r($newArray); What does line 75 show and what do you expect it to show? 85 //note that we do not rely on the checkbox value as not all browsers submit it 86 //instead we rely on the name of the checkbox. Well, that's wrong. The value is submitted IF the checkbox is ticked. If it is not ticked, it is not submitted (this is the same in any language, it's not a php specific thing). -- Postgresql php tutorials http://www.designmagick.com/ Array ( [LOG_ID] = 405 [FDATE] = 15-JUL-01 [ACTYPE] = C172 [ACID] = N17SJ [NLANDINGS] = 1 [NHOURS] = 1.2 ) You will not beleiev this! That great print_rt tip you gave me showed upper case keys in the association.so 74 $count = 0; 75 while ($newArray = oci_fetch_assoc($result)) { 76 if ($count == 0)print_r($newArray); 77 $count = 1; 78 foreach ($fields as $field){ 79 $fieldx = strtoupper($field); fixed 80 ${$field} = $newArray[$fieldx]; 81 $count = $count +1; 82 // print($field); 83 // print_r($newArray[$field]); 84 } Not using count! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] works under mysql 5 but not under Oracle 11g1
Array ( [LOG_ID] = 405 [FDATE] = 15-JUL-01 [ACTYPE] = C172 [ACID] = N17SJ [NLANDINGS] = 1 [NHOURS] = 1.2 ) So everything is uppercase where you're expecting lower case. while ($newArray = oci_fetch_assoc($result)) { foreach ($fields as $field){ $field = strtoupper($field); echo $newArray[$field] . \n; not an ideal solution but it'll work. thanks for the print_r tip! I need to fix ${$field} = $newArray[$field]; ?? i need to properly use the association I have seen no mention of the syntax ${$field} even though it looks reasonable! Variable variables (http://www.php.net/manual/en/language.variables.variable.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] works under mysql 5 but not under Oracle 11g1
Fred Silsbee wrote: while ($newArray = oci_fetch_assoc($result)) { foreach ($fields as $field){ ${$field} = $newArray[$field];// values not making it into variable } print_r($newArray); what is here? Oracle uppercases all fields, tablenames by default (per sql spec). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php