Re: AW: AW: [PHP-DB] php, OCI and datatypes

2001-02-14 Thread dsi safir

Ok, thanks all for the advices.

The problem is linked with the NLS parameters.
Here are my database related param:
NLS_LANGUAGE=French
NLS_TERRITORY=France
NLS_DATE_LANGUAGE= french
NLS_DATE_FORMAT = dd/mm/

I change my query : select CHAR_COL . into select
convert(CHAR_COL, 'US7ASCII')
and it works.

It's not really nice but anyway it's a good first step.

Thanks again

Emmanuel Nectoux
 
 Is source and output from one try? because the number of rows doesn't match
 
 a problem could be the NLS-SETTINGS of your DB,
 maybe they are set to a character set that uses
 2 Bytes per char.
 
 Or yust PHP has a problem to handle CHAR - columns.
 maybe you can overcome that with some type conversions.
 
 Either try something like to_char () or substring () in SQL:
 
 select to_char (colname)   //i#m not sure if that works
 select substr  (colname,1) // or zero, don't know if character counting
 starts with 0 or 1
 
  or
 cast the result values :
 
 $col_1 = (string) ociresult($stmt, "CHAR_COL");
 
 mk
 

 The "Hello" example (" H e l") comes from the sourcecode of
 my browser.
 What's strange is that the two browsers (Netscape 4.03Fr and
 IE 5.0) have different source code for the same page.
 
 It do seems that each CHAR that I manage to fetch is coded
 with two places (in IE).
 
 I tried the following code for example with the same result
 
 ?php
 print "HTMLHEADTITLENice Title, isn't
 it/TITLE/HEADBODYPRE\n";
 $conn = OCILogon("X", "Y", "ZZZBASEZZZ");
 $stmt = OCIParse($conn, "select CHAR_COL,
 OTHER_DATATYPE_COL from CODE_FICHIER");
 OCIExecute($stmt);
 // I fetch the five first rows
 for ($i = 0; $i  5; $i++) {
 ocifetch($stmt);
 $col_1 = ociresult($stmt, "CHAR_COL");
 $col_2 = ociresult($stmt, "OTHER_DATATYPE_COL");
 echo("\"$col_1\"\t\"$col_2\"\t\n");
 }
 
 echo ("/PRE/BODY/HTML");
 ?
 The html source is :
 HTMLHEADTITLEle titre/TITLE/HEADBODYPRE
 " " "308"
 " A B C""626"
 " " "702"
 " A A N""1108"
 " " "1109"
 " 7 5 1""1112"
 ""  ""
 ""  ""
 /PRE/BODY/HTML
 
 I will have a look at the HTTP header (Content-Language or
 mime-type...), who knows


-- 
PHP Database 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]




[PHP-DB] Pbs with Oracle

2001-02-05 Thread dsi safir

Hi everybody,

Still with the same configuration (Apache1.3.14 + PHP4.04pl1
+ support for Oracle
8.0.5 with OCI, all on HP-UX 11), I manage to connect to my
base (ocilogon, ociparse and ociexecute).
After that, whenever I try to get the results, it prints
well the column name but not the data. I try with the three
possibilities : ocifetch, ocifetchinto and
ocifetchstatement.

Here an example :

?
$uid = "";
$pwd = "";
$inst = "MY_INSTANCE";

$conn = ocilogon ($uid, $pwd, $inst) or die ("ocilogon
failed\n");

$query= "select OWNER, TABLE_NAME from ALL_TABLES";
$stmt = ociparse ($conn, $query) or die ("ociparse
failed\n");
ociexecute ($stmt) or die ("ociexecute failed" );

while ( OCIFetch($stmt) ) {
$ncols = OCINumCols($stmt);
for ( $i = 1; $i = $ncols; $i++ ) {
$column_name  = OCIColumnName($stmt, $i);
$column_value = OCIResult($stmt, $i);
print $column_name . " : " . $column_value . "\n";
}
}
?

Any suggestion is welcome...

Emmmanuel Nectoux

-- 
PHP Database 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]