Я сделал мой RESTful MySQL Бэкэнд все хорошо Кроме этого мой
У запроса feteched есть проблема. Я имею в виду, что он ничего не показывает, когда мой возвращенный json — больше чем 2 объекта.
Я работаю с ionic3 / http.
мой select.php:
$sql = "SELECT * FROM products ORDER BY id";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
$data = array() ;
while($row = $result->fetch_assoc()) {
$data[] = $row;
}
echo json_encode($data);
} else {
echo "0";
}
мой сервисный файл в ионном:
getProducts(){
return this.http.get("http://localhost/api/products/select.php")
.map(res=>{
this.checkMe = res;
if(this.checkMe._body !== "0"){
return res.json()
}
} );
}
Мне действительно нужна твоя помощь.
Спасибо вам всем.
ты пытался сделать ..
getProducts(){
return this.http.get("http://localhost/api/products/select.php")
.map(res=>{
this.checkMe = res.json() as any;
if(this.checkMe._body !== "0"){
return res.json()
}
} );
}
я имел HTML-тег в одно из моих полей в MySQL, которое останавливает операцию json_encode ().
Спасибо вам всем