Re: PHP OOP
| From: | Luis Moreira | Date: | Wed, 30 Jun 2004 11:47:13 +0000 |
| Subject: | Re: PHP OOP | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-24085@lists.php.net to get a copy of this message | ||
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