farhan.foxtrot 0 Newbie Poster

In my oracle, there is a table :

locations(
city varchar2(10),
country varchar2(10));

executing the following script results the desired column.

<?php
            $link = oci_connect('SYSTEM', 'abracdabra', 'orcl');
            $s = oci_parse($link, 'select city from locations');

            if(! $s)
            {
                $e = oci_error();
                var_dump($e );
            }

            oci_execute($s);
            $res = oci_fetch_row($s);
            while($res)
            {
                echo $res[0]."<br>";
                $res = oci_fetch_row($s);
            }

            oci_close($link);
  ?>

but if i change the line to

echo $res."<br>"; instead of $res[0]

it shows:
Undefined index: city in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\PhpProject2\index.php on line 44

can anyone give me some hint on how i can access the array using named index??

thanks in advance.