having a bit of an issue here. I'm passing data over an AJAX command to my php script. The data travels across fine.
Print_r
Array
( [0] => stdClass Object
( [Loc] => Main Door
[Module] => O2
[Dect] => O2
[GasDec] => O2
[ScB4] =>
[ScA4] =>
[A1] =>
[A2] =>
[CalGas] =>
[CalGasA] =>
[Factor] =>
[ZB4] =>
[ZA4] =>
[CalB4] =>
[CalA4] =>
[CHNoID] => 5
[JobID] => 3 )
)
I can use The following method just fine but when i use option two it doesn't like it due to this error message:
Catchable fatal error: Object of class stdClass could not be converted to string
Methods
//Method one
echo "JobID: " . $comm[0]->JobID; // result: 3
//Method two
echo "JobID: '$comm[0]->JobID'"; // get error message
The reason im using method two is so I can pass the information into mysql. If anyone knows something i'm missing or it can't be done or even a easier way. please say.
Thanks.
EDIT
Query
$sql = "INSERT INTO
calinfo (Sbefore, Safter, A1, A2, CalGas, Factor, Zbefore, Zafter, Cbefore, Cafter, SysInfoID)
VALUES
('$comm[$i]->ScB4', '$comm[$i]->ScA4', '$comm[$i]->A1', '$comm[$i]->A2', '$comm[$i]->CalGasA', '$comm[$i]->Factor', '$comm[$i]->ZB4', '$comm[$i]->ZA4', '$comm[$i]->CalB4', '$comm[$i]->CalA4', '$comm[$i]->CHNoID');";
$sql .= "UPDATE
jobs
SET
CompletedBy = $tech
WHERE JobID = '$comm[$i]->JobID';"; //<-- when i try the method of "WHERE JobID = ".$comm[$i]->JobID.";"; it doesnt like it...