$sql = "SELECT id FROM chatsystem WHERE user1 = ? or user2 = ?";
<?php
$sql = "SELECT id FROM chatsystem WHERE user1 = ? or user2 = ?";
$stmt = mysqli_stmt_init($connect);
mysqli_stmt_prepare($stmt, $sql);
mysqli_stmt_bind_param($stmt, "ss", $username, $username);
mysqli_stmt_execute($stmt);
$resultData = mysqli_stmt_get_result($stmt);
mysqli_stmt_close($stmt);
while ($row = mysqli_fetch_assoc($resultData)) {
var_export($row);
}