I use JsonObjectRequest in Android with PHP and MySQL and get below error message :
"JSONException: Value <br of type java.lang.String cannot be converted to JSONObject"
Below is my PHP code :
<?php
$month = $_POST['month'];
$connection = new mysqli("localhost","root","","Fubon");
$dateCheckSQLCommand = "select * from clockindata where Month(date)= $month ";
if ($result = $connection->query($dateCheckSQLCommand)) {
while ($row = $result->fetch_assoc()) {
echo json_encode($row);
}
$result->free();
}
$connection->close();
?>
Somebosy say br is newline in html which is not in Json format ?
Beside, I use DateTime type or Timestamp type in MySQL "date" column. My Json response from PHP look like below. Is it about the MySQL setting or the PHP problem ? :
{"account":"Fu","ssid":"Fu","date":"2019-11-14 00:00:00"},{"account":"Fu","ssid":"Fu","date":"2019-11-21 00:00:00"}