I am querying a members table to return all the data in that table, I also have another table that holds members interest and its linked to the members table by the member id. I want to return JSON so the members interest show as an array under the main members object data.
This is what I am getting out
http://www.dile.ng/member/model/getAllMem.php
I will rather just get the interest which shows at the top as seperate objects show as an interest array under each member object
require_once("../functions.php");
$sql="SELECT * FROM members";
$res=mysqli_query($dbconn,$sql);
while($row=mysqli_fetch_assoc($res))
{
$id=$row['member_id'];
$sqla="SELECT interest FROM memint WHERE memid='$id'";
$resa=mysqli_query($dbconn,$sqla);
while($rowa=mysqli_fetch_assoc($resa))
{
$data[]=$rowa;
}
$data[]=$row;
}
echo json_encode($data);