How is it possible for me to get user one and user 2's information back through and Ajax request. Must I do two separate queries like so?
$check = "SELECT * FROM user WHERE id='$user1_id'";
$check1 = mysqli_query($mysqli,$check);
$resultArr = mysqli_fetch_array($check1);
$json['username'] = ucfirst($resultArr['username']);
$json['id'] = $resultArr['id'];
$json['first'] = ucfirst($resultArr['first']);
$json['middle'] = ucfirst($resultArr['middle']);
$json['last'] = ucfirst($resultArr['last']);
mysqli_free_result($check1);
$check2 = "SELECT * FROM user WHERE id='$user2_id'";
$check12 = mysqli_query($mysqli,$check2);
$resultArr2 = mysqli_fetch_array($check12);
$json['username'] = ucfirst($resultArr2['username']);
$json['id'] = $resultArr2['id'];
$json['first'] = ucfirst($resultArr2['first']);
$json['middle'] = ucfirst($resultArr2['middle']);
$json['last'] = ucfirst($resultArr2['last']);
mysqli_free_result($check2);
And when returned I have - '+datamessage['first']+' >> '+datamessage['first']+'
problem is they swap positions in the server side depending on who's sent the message so user 2's name could be first or user1's could be first.