Hi in the below I am printing the group name using echo function.But I want to return the echo message in the form of array.Because these echo message I am reading in client side. for example my output coming like this:
NewGroup-->New is one groupname and Group is the second groupname
Excepted output:
{New},{Group}
php
case "DispalyGroupDetails" :
$userId = authenticateUser($db, $username, $password);
if ($userId != NULL) {
if (isset($_REQUEST['username'])) {
$username = $_REQUEST['username'];
$sql = "select Id from users where username='$username' limit 1";
if ($result = $db -> query($sql)) {
if ($row = $db -> fetchObject($result)) {
$sql = "SELECT g.id,g.groupname
FROM `users` u, `friends` f, `group` g
WHERE u.Id=f.providerId and
f.providerId=g.providerId
GROUP BY g.id, g.groupname";
$theResult = $db -> query($sql);
if ($theResult) {
while ($theRow = $db -> fetchObject($theResult)) {
echo $theRow -> groupname;
}
$out = SUCCESSFUL;
} else {
$out = FAILED;
}
} else {
$out = FAILED;
}
} else {
$out = FAILED;
}
} else {
$out = FAILED;
}
} else {
$out = FAILED;
}
break;