PHP Mysqli foreach not pulling data -


i have got following php sites inside <script> tags , trying pull data table map using mysqli

but in console.log shows following position: new google.maps.latlng(, ),

i'm unsure have went wrong in code. database connection live , inside variable $con

php

  <?php    $count = 0;   $rowset = $con->query("select * map");   foreach ($rowset $row): ?>   add_marker({         position: new google.maps.latlng(<?php echo $row->lat ?>, <?php echo $row->lng ?>),         title:<?php echo $row->location ?>,         map:map     });   <?php    $count++;   endforeach; ?> 

thanks in advance

you not pulling data. replace foreach line this:

while ($row = $rowset->fetch_object()): 

that should it.

edit: don't forget replace endforach; endwhile;


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -