请告诉我解决方案
这是我的PHP代码 <?php
//Creating a connection
$con = mysqli_connect("___","___","___","___");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
/*Get the id of the last visible item in the RecyclerView from the request and store it in a variable. For the first request id will be zero.*/
$id = $_GET["id"];
$sql= "Select * from db_app where id between ($id+1) and ($id+10)";
$result = mysqli_query($con ,$sql);
while ($row = mysqli_fetch_assoc($result)) {
$array[] = $row;
}
header('Content-Type:Application/json');
echo json_encode($array);
mysqli_free_result($result);
mysqli_close($con);
?>
这是我的数据库代码
CREATE DATABASE `android_db`;
USE `android_db`;
CREATE TABLE IF NOT EXISTS `db_app` (
`id` int(15) NOT NULL AUTO_INCREMENT,
`movie_name` varchar(45) NOT NULL,
`movie_image` varchar(10000) NOT NULL,
`movie_genre` varchar(40) NOT NULL,
PRIMARY KEY (`id`)
);
答案 0 :(得分:3)
未设置字符集时会发生这种情况。
尝试mysql连接后,
/* change character set to utf8 */
if (!$mysqli->set_charset("utf8")) {
printf("Error loading character set utf8: %s\n", $mysqli->error);
exit();
} else {
printf("Current character set: %s\n", $mysqli->character_set_name());
}