Hi in the below code select query executing but output giving 3 times all the record values.
For example where I am passing username as user2 it giving output 45New45New45New46New46New46New47New47New47NewSUCCESSFULLY
But In my database it contains only 3 records:
id 47 48 49
groupname:New New New
I am expeting output above one.But I am getting 3 times.
Where I did the mistake.
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";
$theResult = $db->query($sql);
if ($theResult) {
//$theRow = $db->fetchObject($theResult);
while( $theRow = $db->fetchObject($theResult))
{
echo $theRow->id;
echo $theRow->groupname;
}
$out = SUCCESSFUL;
} else {
$out = FAILED;
}
}
else
{
$out = FAILED;
}
}
else
{
$out = FAILED;
}
}
else
{
$out = FAILED;
}
}
else
{
$out = FAILED;
}
break;