Re: PHP OOP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ragnar wrote:

Hi lads,

I'm just tinkering around in PHP again recently, I haven't done much
OO in general, so I wasn't too surpised when some of the stuff I did
today didn't work.

Example:

(DB abstraction):

function data($qry_result){
 if ($qry_result){
   return ibase_fetch_object($qry_result);
 }
}

(Item function)

function show_item($item) {
$sublvl = $_GET['sub'];

$qry_item = query("select ITMLIST.*, GRPLIST.NAME AS SUBNAME from ITMLIST,
GRPLIST where ITMLIST.ITEM_ID=$item AND GRPLIST.GROUP_ID = ITMLIST.PARENT_ID
AND ITMLIST.PARENT_ID = $sublvl");
$obj_item = data($qry_item);
if ($obj_item){ return $obj_item; } }


--------------------

Can someone tell me why I can't access the object that I want to have
returned .. or rather why it seems to be empty.

If I do <?= $obj_item->NAME ?> I don't get any output.

It's possibly because I am trying something stupid, but I'd really like it
if I could return that object, so I could output the bits that it has more
conviently (in templates etc.)

cheers,

Ben



Check (echo) the query string to see if it is properly formated.
If so, see if the "=" sign is the best one for your comparison. Sometimes it isn't...


Luis

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux