Re: PHP OOP

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

 



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

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