> apparently $rec[0] is a php object - try the following lines to
> find out what's inside:
>
> echo '<pre>';
> print_r($rec[0]);
> echo '<pre>';
>
> that will probably give you a clue as to how to extract some
> useful info from the object.

Excellent!  Yes, it now does give me a clue to see what's actually in the
object.  print_r($rec[0]) shows:

stdClass Object ( [year] => 2005 [month] => 8 [day] => 31 [hour] => 0
[minute] => 0 [second] => 0 [fraction] => 0 )

I've never dealt with object in PHP.  Something new learnt today.  I'm now
able to use get_object_vars($rec[0]) to extract the info from the object. 
There is one thing I don't understand though.

Is there anything wrong with the follow code snippet?  The result of echo
is 'using list, year is" rather than 'using list, year is 2005'.

==
list($year,$month,$day,$hour,$minute,$second,$fraction) =
get_object_vars($rec[0]);
echo "using list, year is $year<br>";
==

This one works.  But I prefer using list.

==
$arr = get_object_vars($rec[0]);
echo "year is $arr[year]<br>";
==

Thanks,

Bing

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

Reply via email to