Forum Stats

  • 3,826,668 Users
  • 2,260,687 Discussions
  • 7,897,044 Comments

Discussions

Why can't display?

405030
405030 Member Posts: 1
edited Sep 28, 2003 10:28PM in PHP
My code is
<?php
print "<HTML><PRE>";
$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)))(CONNECT_DATA=(SID=orcl)))";
$c1 = ocilogon("RASAMEE ","database",$db);

function select_data($conn) {
$stmt = ociparse($conn,"select * from leader");
ociexecute($stmt,OCI_DEFAULT);

echo $conn." <----selecting\n";
echo "-----------------------\n";

while (ocifetch($stmt)){
echo ociresult($stmt,"name")." ";
echo ociresult($stmt,"surname")." ";
echo "hi";
echo ociresult($stmt,"tel")."\n";
}
echo $conn." <----done\n\n";
}

select_data($c1);
ocilogoff($c1);
print "</PRE></HTML>";
?>
I had created leader table with have 4 records (4 name,4surname,4tel)
but the result has shown
"
Resource id #4 <----selecting
-----------------------
hi
hi
hi
hi
Resource id #4 <----done
"
that's I don't know why...............
why I can't use function ociresult ?
could someone answer me,please?
Thank lots!

Comments

  • 3047
    3047 Member Posts: 307
    Try uppercase column names in the ociresult() calls.
    E.g.
    while (ocifetch($stmt)){ 
      echo ociresult($stmt,"NAME")." "; 
      echo ociresult($stmt,"SURNAME")." "; 
      echo ociresult($stmt,"TEL")."\n";
    } 
    See http://www.php.net/manual/en/function.ociresult.php

    -- CJ
This discussion has been closed.