Hi--
In times past (in fact, within the same web site) I use
OCIFetchStatement($qry, $arrayResults);
Later I use the following code to access a value within the array:
$arrayResults['FIELD'][0]
This works great!
BUT, now I have a slightly more complicated query. When I call
OCIFetchStatement(...) I get the right number of rows reported, but the
technique used above no longer accesses the information. I get a "Not a
T_VARIABLE or T_NUM...blah blahh.. " error.
Here is the query--all the columns are aliased.
----------------------------------------------------------------------------
--------------------------------------------------------------
$qryStr = "select ig.value as IMG,
im.value as MSG,
ut.name as F_NAME,
ut.addr1 as F_ADDR1,
ut.addr2 as F_ADDR2,
ut.city as F_CITY,
ut.state as F_STATE,
ut.zip as F_ZIP,
a.fname as T_FNAME,
a.lname as T_LNAME,
a.prefix as T_PREFIX,
a.suffix as T_SUFFIX,
a.addr1 as T_ADDR1,
a.addr1 as T_ADDR2,
a.city as T_CITY,
a.state as T_STATE,
a.zip as T_ZIP
FROM productout po, item ig, item im, usertbl ut, address a
WHERE
ig.userid = ut.userid and
po.addressid = a.addressid and
ig.type = 'IMG' and
ig.itemid in(select itemid from product
where productid = po.productid) and
im.type = 'MSG' and
im.itemid in(select itemid from product
where productid = po.productid)
union
select
ig.value as IMG,
im.value as MSG,
ut.name as F_NAME,
ut.addr1 as F_ADDR1,
ut.addr2 as F_ADDR2,
ut.city as F_CITY,
ut.state as F_STATE,
ut.zip as F_ZIP,
a.fname as T_FNAME,
a.lname as T_LNAME,
a.prefix as T_PREFIX,
a.suffix as T_SUFFIX,
a.addr1 as T_ADDR1,
a.addr1 as T_ADDR2,
a.city as T_CITY,
a.state as T_STATE,
a.zip as T_ZIP
FROM productout po, item ig, item im, usertbl ut, address a, addr_groups ag
WHERE
ig.userid = ut.userid and
po.addrgrpid = ag.addrgrpid and
a.addressid = ag.addressid and
ig.type = 'IMG' and
ig.itemid in(select itemid from product
where productid = po.productid) and
im.type = 'MSG' and
im.itemid in(select itemid from product
where productid = po.productid)";
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--------------------
Why won't the following work:
for($i = 0; $i < $numRows; $i++)
{
echo "$arrayResults['IMG'][$i]<br>";
}
Neither will this:
$arrayResults[0][0];
Here is some info:
list($key, $value) = each($arrayResults);
echo "$key"; ==> IMG
echo "$value"; ==> Array
list($key2, $value2) = each($value);
echo "$key2"; ==> 0
echo "$value2"; ==> path/image1.jpg
This tells me that this:
$arrayResults['IMG'][0]
should return:
path/image1.jpg
It doesn't. PHP returns all column names as invalid keys. Yet it returns
all the column names as keys when I ask it too.
What am I missing?
Thanks
RDB
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php