<?php header('Content-type: text/html; charset=utf-8'); $db_host=""; $db_user=""; $db_password=""; $db_name = ""; $mysqli = new mysqli($db_host, $db_user, $db_password, $db_name); if (mysqli_connect_errno()) { printf("Ошибка соединения: %s\n", mysqli_connect_error()); exit; } $mysqli->set_charset("utf8"); if ($stmt = $mysqli->query('SELECT * FROM vtiger_contactdetails, vtiger_timesheet, vtiger_timesheetcf WHERE vtiger_contactdetails.contactid = vtiger_timesheet.cf_2295 AND vtiger_timesheet.cf_2295 = vtiger_timesheet.timesheetid')) { while($row = $stmt->fetch_assoc()){ echo $row['lastname'].' '.$row['cf_2295'].'<br />'; } } ?>
The code works without vtiger_timesheet, and the last condition
AND vtiger_timesheet.cf_2295 = vtiger_timesheet.timesheetid
It is necessary that all the tables be connected and that the conditions work.
Tell me how to write requests?