Re: PHP OOP

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

 



Ok .. I figured it out now guys. Sorry for the hassle.

returning the object is fine, but if you don't assign another variable
with it after the function call it doesn't presist.

So what I did was (after the function declaration in the code):

if ($_GET['item']) $newitem = show_item($_GET['item']);

and then just use $newitem->property to output.

Ben
 
> Thanks for the answers so far guys ... the thing that puzzles me is
> that the query definately works fine, because if I do this:
> 
> -----------
> 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){
>     print $obj_item->NAME; 
>     return $obj_item;
>    } else {
>      print "No data";
>    }
> }
> -------------
> 
> the output is fine, and when I uncomment the print line and call the
> script
> i do not get the "No data" message, as the object exists.
> 
> Could it be that it is just not possible to return the sort of object that
> ibase_fetch_object returns from a function ?
> 
> cheers,
> 
> Ben
> 
> > Ross Honniball wrote:
> >
> > I'm guessing your ibase_fetch_object($qry_result) call does not 
> > successfully retrieve any data. It then returns false and your calling 
> > script does nothing if false is returned.
> 
> -- 
> +++ Jetzt WLAN-Router für alle DSL-Einsteiger und Wechsler +++
> GMX DSL-Powertarife zudem 3 Monate gratis* http://www.gmx.net/dsl
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
+++ Jetzt WLAN-Router für alle DSL-Einsteiger und Wechsler +++
GMX DSL-Powertarife zudem 3 Monate gratis* http://www.gmx.net/dsl

-- 
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