How to get multiple rows from a database in an app?

Hello,

I'm trying to find out how to get multiple rows from a mysql database to an app but unfortually I can't get this to work.

I have a page like this



In stead of NAAM and beneath ENKEL and DUBBEL there must be some data from the mysql database.

This data will have several records so there will be NAAM1 and ENKEL1 and DUBBEL1. Beneath this record will be another record, NAAM2 and ENKEL2 and DUBBEL2 and so on.

Normally you will do this in php with a WHILE loop but how do I do this in Appery?

I have this REST API code:

$id = $app->request->post('id_from_local_storage');

$result = mysqli_query($con, "SELECT * FROM tennisrating_users WHERE id = '$id'") or die("Error: ".mysqli_error($con));

while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) {
$bondsnummer = $row["bondsnummer"];
$geslacht = $row["geslacht"];
$achternaam = $row["naam"];
$achternaam_geslacht = $row["naam"] . "(" . $row["geslacht"] . ")";
$response["error"] = false;
$response["bondsnummer"] = $bondsnummer;
$response["geslacht"] = $geslacht;
$response["achternaam"] = $achternaam;
$response["achternaam_geslacht"] = $achternaam_geslacht;

$result_ranking = mysqli_query($con, "SELECT * FROM tennisrating_rating WHERE id = '$id' AND bondsnummer = '$bondsnummer' ORDER BY datum DESC LIMIT 1");

while ($row_ranking = mysqli_fetch_array($result_ranking, MYSQLI_BOTH)) {
$enkel = $row_ranking["enkel"];
$dubbel = $row_ranking["dubbel"];
$response["enkel"] = $enkel;
$response["dubbel"] = $dubbel;
}
}

How do I loop with Appery through this data so I can make a view of users which have the same id = 847814729x1412605206?

Kind regards,

Arie
1 person has
this question
+1
This topic is no longer open for comments or replies.