Re: PHP OOP

From: Date: Thu, 01 Jul 2004 04:35:18 +0000
Subject: Re: PHP OOP
References: 1 2  Groups: php.windows 
Request: Send a blank email to php-windows+get-24093@lists.php.net to get a copy of this message
Have a 'look' at the object that is getting returned. Insert 'asdf($obj_name);' as shown below and also put this script in your code. function asdf($object, $where=false) // Used for debugging. Reason for odd name is easy to type but also easy to find in code to get rid of {
    $type = gettype($object);
    echo '<pre>';
    echo '<br>### '.$where.' ### Type='.$type.' Value=';
    if ($type == 'array') {
        print_r($object);
    } elseif ($type == 'object') {
        $class_vars = get_class_vars(get_class($object));
        echo "Class vars:\n";
        foreach ($class_vars as $name => $value) echo "$name : $value\n";
        echo "Class methods:\n";
        $class_methods = get_class_methods($object);
        foreach ($class_methods as $name => $value) echo "$name : $value\n";
        echo "Object vars:\n";
        $class_vars = get_object_vars($object);
        foreach ($class_vars as $name => $value) {
            echo "$name : $value\n";
            if (gettype($value) == 'array') print_r($value);
        }
    } else {
        echo $object;
    }
    echo '</pre>';
} At 12:18 PM 1/07/2004, you wrote:
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);
asdf($obj_name);
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
. . Ross Honniball. JCU Bookshop Cairns, Qld, Australia. .

« previous php.windows (#24093) next »