looking at the php function bellow i have this scenario: there is more then one IdUserfollow each id have to be passed on result2 and all the retrieved values have to be combined and returned to Xcode
function viewhome($IdUser){
$result1 = query("SELECT * FROM follows WHERE IdUser = '%s' ", $IdUser);
$IUser = $result['result'][0]['IdUserfollow'];
$result2 = query("SELECT * FROM photos WHERE IdUser = '%s' ORDER BY IdPhoto DESC LIMIT 50", $IUser);
print json_encode($result2);
}
how can i do that.
i sow this problem Using a Loop Inside a Function which was similar to mine but still I'm confused. considering that my return will be using JSON and also i don't know how to set the loop limit from the first query result. is it possible that i will have to do two functions, the first one will return the number of repetition and the second one will only have the loop and return the result? if yes then how can i combine two results - or whatever the value of the repetition is- and send it back using json
any help would be appreciated.