0
<table class="table table-bordered">
<thead>
    <tr>
      <th>Date</th>
      <th>Client Name</th>
      <th>Location</th>
      <th>Distance Travelled</th>
      <th>Travel Track</th>                                       
    </tr>
</thead>
<?php 
    include 'db.php';
    $sql = 'SELECT travel_allwnce.date_of_travel, location.latitude, location.longitude, meeting_details.client_cname FROM travel_allwnce INNER JOIN meeting_details ON meeting_details.uid = travel_allwnce.uid INNER JOIN location ON location.uid = travel_allwnce.uid';         
    $travel = mysqli_query($conn,$sql);     
while ($row = mysqli_fetch_array($travel)) 
{?>         
<tbody>
    <tr class="active">
    <?php
        $latlong = $row[1].','.$row[2];
        $url = "http://maps.googleapis.com/maps/api/geocode/json?latlng={$latlong}&sensor=false";
        $ch = curl_init($url);          
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $output = curl_exec($ch);
        curl_close($ch);
        $geocode = json_decode($output);
    ?>
    <td><?php echo $row[0];?></td>                  
    <td><?php print_r($geocode->results[0]->formatted_address);?></td>
    <td><?php echo $row[3];?></td>            
    <td><?php echo $row[3]?></td>
    <td><?php echo $row[3]?></td>             
    </tr>                               
</tbody>

Same code works fine on localhost. but gives error on local server. Notice: Undefined offset: 0 in /home/adnacbsllp/adtrack.adnacgroup.com/tables.php

Notice: Trying to get property of non-object in /home/adnacbsllp/adtrack.adnacgroup.com/tables.php

please help me with the same.

mahadev sutar
  • 171
  • 2
  • 16

0 Answers0