Dear all,
I am having serious trouble making multiple joins work (fetching the results) with OCI8 and Oracle 8 on Linux.
Here is my code:
$sel_stmt = "SELECT TO_CHAR(end_time, 'YY-MM-DD-HH24:MI:SS') AS end_t, TO_CHAR(beg_time, 'YY-MM-DD HH24:MI:SS') AS beg_t, s.src_port, s.dst_host, s.dst_port, s.dst_port, ha.name AS NAMEA FROM nstadm.sessions s, nstadm.hosts ha, nstadm.hosts hb WHERE s.src_host = ha.id and dst_host = hb.id and dst_port = '$dst_port' ORDER by beg_time";
executing the statement...
$conn->statement($sel_stmt);
for ($i=0;$i < $conn->numrows;$i++) {
print "\n";
$id = $conn->results["ID"][$i];
printf("% 10d", $id);
$prot = $conn->results["PROT"][$i];
printf("% 10d", $prot);
$src_host = $conn->results["NAMEA"][$i];
printf("% 10d", $src_host);
$src_port = $conn->results["SRC_PORT"][$i];
...
--
Here for example BEG_T prints okay the time (it uses AS structure also). But NAMEA just prints "0". I have tried almost everything, trying to print out S.NAMEA, namea, etc.
The SQL statement is just a copy-paste from SQLPLUS editor and it works there. Now it is a mystery, why it doesn't work in the PHP?
Thanks for help.
hacker...