$sb, 'o' => $o))); $sql = mysqli_query( $mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM networks LEFT JOIN locations ON location_id = network_location_id WHERE network_client_id = $client_id AND (network_name LIKE '%$q%' OR network_vlan LIKE '%$q%' OR network LIKE '%$q%' OR network_gateway LIKE '%$q%' OR network_dhcp_range LIKE '%$q%' OR location_name LIKE '%$q%') ORDER BY $sb $o LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); ?>