By default, column names in Oracle are stored/handled/returned in uppercase. To get change this, you have two options, of which I highly recommend the first:
1) Use double-quotes to alias the column name in your SELECT statements.
When creating your table as you normally would do:
CREATE TABLE rolodex (first_name VARCHAR2(9), last_name VARCHAR2(9), gmt_offset NUMBER);
INSERT INTO rolodex VALUES ('Tom', 'Lehrer', -5);
INSERT INTO rolodex VALUES ('Billy', 'Gates', -8);
INSERT INTO rolodex VALUES ('Richard', 'Walker', -6);
COMMIT;
When retrieving data from it: (note the column aliases)
Get USER data
$getuser = OCIParse($conn, 'SELECT first_name "First_Name", last_name "Last_Name", gmt_offset "GMT_Offset" FROM rolodex');
OCIExecute($getuser);
$numres = OCIFetchstatement($getuser, $userres);
OCIFreestatement($getuser);
for($i=0;$i<$numres;$i++)
{
$fname[$i] = $userres["First_Name"][$i];
$lname[$i] = $userres["Last_Name"][$i];
$gmt_offset[$i] = $userres["GMT_Offset"][$i];
}
2) Use double-quotes to explicitly specify the case of the column name in the
CREATE TABLE statement, then use double-quotes everwhere the column name is
referenced.
When creating your table, explicitly specify the spelling of the column names:
CREATE TABLE rolodex ("First_Name" VARCHAR2(9), "Last_Name" VARCHAR2(9), "GMT_Offset" NUMBER);
INSERT INTO rolodex VALUES ('Tom', 'Lehrer', -5);
INSERT INTO rolodex VALUES ('Billy', 'Gates', -8);
INSERT INTO rolodex VALUES ('Richard', 'Walker', -6);
COMMIT;
When retrieving data from it: (note the double-quotes)
Get USER data
$getuser = OCIParse($conn, 'SELECT "First_Name", "Last_Name", "GMT_Offset" FROM rolodex');
OCIExecute($getuser);
$numres = OCIFetchstatement($getuser, $userres);
OCIFreestatement($getuser);
for($i=0;$i<$numres;$i++)
{
$fname[$i] = $userres["First_Name"][$i];
$lname[$i] = $userres["Last_Name"][$i];
$gmt_offset[$i] = $userres["GMT_Offset"][$i];
}
Please let me know if this answers your question.
-- Michael
Darkstreak Computing & Innovations
www.darkstreak.com