我创建了一个 json 输出,但得到了这些错误,有什么想法吗?!
代码 1:
public function getChatRoomData($uid, $name, $mess, $_roomID)
{
mysql_query("INSERT INTO _roomData(uid, userName, messageText, roomID, postedAt) VALUES('$uid', '$name', '$mess', '$_roomID', NOW())");
return mysql_query("SELECT * FROM _roomData WHERE roomID = '$_roomID';");
}
代码 2:
if ($tag == 'roomEnter') {
$userID = $_POST['_uniqeID'];
$userName = $_POST['_name'];
$userMessage = $_POST['_message'];
$roomID = $_POST['_roomID'];
$queryFunctions = $db->getChatRoomData($userID , $userName, $userMessage, $roomID);
$rows = array();
while($result = mysql_fetch_assoc($queryFunctions))
{
$rows["uid"] = $result["uid"];
$rows["name"] = $result["userName"];
$rows["roomDetails"]["message"] = $result["messageText"];
}
echo json_encode($rows);
}
日志错误:
07-30 18:59:46.843: E/JSON(26633): <br />
07-30 18:59:46.843: E/JSON(26633): <b>Parse error</b>: syntax error, unexpected '}' in <b>/home/merlinga/public_html/_mess/index.php</b> on line <b>106</b><br />
07-30 18:59:46.944: E/JSON Parser(26633): Error parsing data org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
07-30 19:02:30.293: E/JSON(26633): <br />
07-30 19:02:30.293: E/JSON(26633): <b>Parse error</b>: syntax error, unexpected '}' in <b>/home/merlinga/public_html/_mess/index.php</b> on line <b>106</b><br />
07-30 19:02:30.293: E/JSON Parser(26633): Error parsing data org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject