0
您好,我是Android新手。我的问题是我的json
值:显示数组位置的json数组
<?php
include 'dbconfig.php';
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM textviewtable";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row[] = $result->fetch_assoc())
{
$json = json_encode($row);
}
}
else {
echo "0 results";
}
echo $json;
$conn->close();
?>
JSON
[ { “ID”: “8”, “ServerData”: “ABC”, “名”: “XYZ” ,“pincode”:“123456”} {“id”:“9”,“ServerData”:“DEF”,“name”:“JHG”,“pincode”:“654321”}, {“id” :“10”,“ServerData”:“GHI”,“名称”:“KIH”,“pincode”:“142536”} ]
JSON的ServerData
,name
和pincode
对象是各行上相同的,但我需要每一行的ServerData
,name
和pincode
有所不同。
所以,第一行我想告诉ServerData
,name
,pincode
和第二行我想告诉ServerData1
,name1
,pincode1
等我怎样才能做到这一点?
不工作,相同的outpoint打印 – mohit