使用Postman查看php的这一部分是否按预期工作,但Postman返回错误//build the map
Map<Integer, Organization> orgsInDB = new HashMap<>();
for( Organization org : organizationList ) {
orgsInDB.put(org.getId(), org );
}
//match
for( Organization org : organizations ) {
Organization orgInDB = orgsInDB.get( org.getId() );
if( orgInDB != null ) {
orgInDB.setFollowed( true );
}
}
且数据库未更新,无法理解这个错误,因为它对我来说很好看? / p>
代码:
Malformed JSON: Unexpected 'U'
答案 0 :(得分:1)
执行时
echo json_encode('Vote added');
应该没有问题。是否有抛出导致此错误的异常? 尝试将SQL语句更改为
$query = "UPDATE User SET votesAttained=votesAttained+1 WHERE USER_NAME = " . $username;