$query = 'SELECT * FROM dialogs WHERE u1id = 1 or u2id = 1';
$result = mysqli_query($link, $query);
var_dump($result);
if($result){
$row = mysql_fetch_row($result);
print_r($row);
}
mysql_free_result($result);
object(mysqli_result)#2 (5) { ["current_field"]=> int(0) ["field_count"]=> int(4) ["lengths"]=> NULL ["num_rows"]=> int(2) ["type"]=> int(0) }