note 25533 modified in function.ociresult by sixd

From: Date: Thu, 08 Oct 2009 19:31:44 +0000
Subject: note 25533 modified in function.ociresult by sixd
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-161559@lists.php.net to get a copy of this message
Note that if you are making multiple table selects, you must specify an alias to each column. This wont work: ---------------------------------------- $qry = "SELECT A.COL_ONE, B.COL_ONE FROM TABLE1 A, TABLE2 B"; $stmt = OCIParse($conn, $qry); while(OCIFetch($stmt)) { $a = OCIResult($stmt, "A.COL_ONE"); ... ---------------------------------------- But this will: ---------------------------------------- $qry = "SELECT A.COL_ONE AS X, B.COL_ONE AS Y FROM TABLE1 A, TABLE2 B"; $stmt = OCIParse($conn, $qry); while(OCIFetch($stmt)) { $a = OCIResult($stmt, "X"); ... ---------------------------------------- Regards, --was-- Note that if you are making multiple table selects, you must specify an alias to each column. This wont work: ---------------------------------------- $qry = "SELECT A.COL_ONE, B.COL_ONE FROM TABLE1 A, TABLE2 B"; $stmt = OCIParse($conn, $qry); while(OCIFetch($stmt)) { $a = OCIResult($stmt, "A.COL_ONE"); ... ---------------------------------------- But this will: ---------------------------------------- $qry = "SELECT A.COL_ONE AS X, B.COL_ONE AS Y FROM TABLE1 A, TABLE2 B"; $stmt = OCIParse($conn, $qry); while(OCIFetch($stmt)) { $a = OCIResult($stmt, "X"); ... ---------------------------------------- Regards, http://php.net/manual/en/function.ociresult.php

« previous php.notes (#161559) next »