MySQLi: bind_param and objects

Hi,

I want to use MySQLi with prepared statements so I’ve prepared the query with the DB object:

$update = $db->prepare(“UPDATE bla SET xx=?, yy=? WHERE zz=?”);

Because my application is fully OOP, I have objects with the data I want to use for the query.

class BlaData {var $x;var $y;var $z}$data = array(Lots of BlaData objects);

Now I want to execute the update query for every object in the array.

foreach(…) {$update->…???$update->Execute();}

How can I now bind the BlaData->x, y and z vars to the query without using local variables in bind_param? All samples of bind_param work so:

$stmt->bind_param(“ii”,$var1,$var2);foreach() { $var1 = rand(); $stmt->execute();}

I tried:

$fd = new BlaData(); //empty$stmt->bind_param(“ii”,$fd->x,$fd->y);for($i… count($data)… $i++) { $fd = $data[$i] $stmt->execute();}

But it doesn’t work, it looks like bind_param uses the (empty) object I’ve used to first time on every execute() again.

I think that’s because bind_param stores a reference to the variable which doesn’t change to a new value if I reassign the $fd object.

Is there a way to use the object properties without copying everything from the object to a local variable first? Or is it possible to call bind_params(); every time in the loop before ->Execute() or will this affect the performance negatively?
If bind_params causes a round trip to the MySQL Server, calling it every time before Execute() is not really an option.

Thanks and best regards,

Himalian