【发布时间】:2016-03-12 15:08:26
【问题描述】:
好的,这就是我在 php 文件中的代码。我基本上想在
中阅读所有内容 //Read the username and password from ServerRequest class
$username = $_POST["username"];
//Select all rows when the username match the input
$statement = mysqli_prepare($con, "SELECT * FROM Chore WHERE username = ?");
mysqli_stmt_bind_param($statement, "s", $username);
mysqli_stmt_execute($statement);
//store the results of the previous query and create a variable for each column returned
mysqli_stmt_store_result($statement);
mysqli_stmt_bind_result($statement,$chore_name ,$point_value, $parent_username, $child_username, $created, $points_given);
$chore = array();
//store the previous variables you created in the array (only the ones you want to use)
while(mysqli_stmt_fetch($statement)) {
$chore['chore_name'] = $chore_name;
$chore['child_username'] = $child_username;
$chore['point_value'] = $point_value;
}
//encode the array in JSON format
echo json_encode($chore);
//close the statement
mysqli_stmt_close($statement);
//Close the database connection
mysqli_close($con);
我想知道如何读取每个条目以在 android studio 中显示为列表视图?
【问题讨论】: