Hi guys.
I can't find an answer at PHP-WIN maillist. So I
forward the email here. Wish someone will help me.
Thanks a lot.
======================================================
Thank you for your suggestion. But it doesn't work.
The line
$VusersArray = $Vusers->Next($Vusers->{'Count'});
doesn't work. PHP said:
==================================================
<b>Warning</b>: Unable to lookup next: Unknown name.
in <b>tt.php</b> on line <b>8</b><br>
==================================================
I am new in PHP and COM. I think it is a common
question. There should be a way to solve it. But if
PHP can't handle so simple a task, it's a big problem
for him. Such as database in PHP, I can't believe that
they provide different methods for different database.
It's not like a new and professional language.
Anyway, thank alain samoun again for your help.
Regards,
--- alain samoun <[EMAIL PROTECTED]> wrote:
> Use variant, Try:
> <?php
> $AU = new COM("Persits.AspUser");
> $Vusers = new VARIANT("", VT_BSTR|VT_BYREF);
> $Vusers = $AU->LocalUsers;#Should be returning a
> collection
> $VusersArray =
> $Vusers->Next($Vusers->{'Count'});# Get the
> collection in array
> foreach ($VusersArray as $Vusers)
> {
> $VusersSet->Reset;
> $username=$Vusers->{'name'} ;
> $userfullname=$Vusers->{'fullname'} ;
> print "User name: $username Full name:
> $userfullname<BR>";
> }
> ?>
> Didn't test it maybe some bug...
> A+
> Alain
>
> -----Original Message-----
> From: Flower Rose [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 27, 2001 4:15 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] How to use the Object returned
> from COM?
>
>
> I want to try a PHP script which use COM Object.
> But I don't know how to use the data returned from
> COM.
>
> There is an ASP example on how to use the data.
> =======================
> <%
> Set AU = Server.CreateObject("Persits.AspUser")
> For Each User in AU.LocalUsers
> Response.Write User.Name & " (" & User.FullName &
> ")<BR>"
> Next
> %>
>
> It will print all users, such as: Administrator,
> Guest...... (10 users now)
> =======================
> But how to use it in PHP?
> =======================
> <?
> $AU = new COM("Persits.AspUser");
> $user = $AU->LocalUsers;
> echo $user->Count(); // It will print 10. That's
> right
>
> //I want to access those 10 users. But I can't find
> a
> //way. Anybody know how to access it? Thanks.
> //The $user is an object, not a object array. Any
> other method I can use to get those data? Actually,
> I
> just find the method Count(). Any documents about
> these?
> ?>
>
> BTW, all class/object function, such as:
> get_class_methods, get_class_vars, get_object_vars
> return unuseful results. If I use print_r to print
> it,
> it's like:
> Array {[0]->2}.... That's not what I want. The
> method
> Count, I just find it by accident.........
>
> Regards,
>
> __________________________________________________
> Do You Yahoo!?
> Make a great connection at Yahoo! Personals.
> http://personals.yahoo.com
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
>
__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]