Here is my simple query:
$sql = "SELECT * FROM donations Order By userid";
$result = $mysqli->query($sql);
while($row = $result->fetch_assoc()){
$json[] = $row;
}
$data['data'] = $json;
I use it to display all data from the 'donations' in a table. Fields are: userid,date,amount
.
In that same table, I'd like to add firstname
and lastname
of corresponding userid
which are stored in mymembers
table. The condition should be WHERE donations.userid = mymembers.id
.
I need help adding that condition for every row resulting from the $sql
query.