(for context purposes)
$Con = new COM("ADODB.Connection") or die ("Error");
$Con->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DB.MDB");
$Qry = $Con->Execute($SQL); // Recordset
This code works
$F = $Qry->Fields(0);
$FieldValue = $F->value;
But I would rather write
$FieldValue=$Qry->Fields(0)->value;
for which PHP complains with the following message:
Parse error: parse error, unexpected T_OBJECT_OPERATOR in line...
Can you tell me why?
Why this code doesn't work?
Moderator: General Moderators
-
LastWalrus
- Forum Newbie
- Posts: 2
- Joined: Fri May 31, 2002 9:16 am
- Contact:
$Qry is a instance of a class
$Fields is a function of the $Qry class
$F is the return value from the $Fields function
$F->value returns the value of $F and puts it in $Fieldvalue
$FieldValue=$Qry->Fields(0)->value;
This asks for the value of the fields function in the $Qry class..
Functions dont have values but they can return values.
This is my guess anyway.
$Fields is a function of the $Qry class
$F is the return value from the $Fields function
$F->value returns the value of $F and puts it in $Fieldvalue
$FieldValue=$Qry->Fields(0)->value;
This asks for the value of the fields function in the $Qry class..
Functions dont have values but they can return values.
This is my guess anyway.
-
LastWalrus
- Forum Newbie
- Posts: 2
- Joined: Fri May 31, 2002 9:16 am
- Contact: