php - Iteration over an object -
i need help please regarding pdostatement::commit (from phpnet manual)
i don't understand illustration #1, because of part of code:
foreach ($fruits $fruit) { $sth->execute(array( $fruit->name, $fruit->colour, $fruit->calories, ) );
1# - iterate on object, array or what? - i've tried both ... , of course, both give errors - definitely, -> operator tells me it's object, still don't understand syntax. - possible iterate/acces simultaneously more 1 property of object? 2# - when said "insert multiple records...", understand "more 1 row", wrong?
thank you.
they iterate on array $fruits
apparently. declared , filled out of scope of given code snippet. $fruits
contains object given field. create class, fill $fruits
. "when said "insert multiple records...", understand "more 1 row", wrong?" - means 0 n rows.
php
No comments:
Post a Comment