append object to another object in php

xuanhuy238

New Member
\[code\]foreach(range(1,$oc->num_users) as $num) { $user = 'user' . $num; $$user = mysql_fetch_object(mysql_query("SELECT user".$num.", user".$num."_ready, FROM oc_db WHERE leader='".$_SESSION['username']."' ")); \[/code\]This gives objects named user1..X later I have a simular function like this, where I use the \[code\]$$user->$user\[/code\] that represent a username to connect to the db to get additional information. \[code\] $$user = mysql_fetch_object(mysql_query("SELECT x, y, z FROM user_db WHERE username='".$$user->$user."' "));\[/code\]This also makes objects named user1..X, but instead of replacing the object created earlier I want to append this values to the object I created in the first function. \[code\]$$user\[/code\] is the name of the objects. I would like to do something like \[code\]$$user .= fetch_object\[/code\] in the last function, but off course it's not that simple.
 
Back
Top