Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7657205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:58:03+00:00 2026-05-31T12:58:03+00:00

<? $query = mysql_query(SELECT * FROM poi_example); while ($row = mysql_fetch_array($query)){ $name=$row[‘name’]; $lat=$row[‘lat’]; $lon=$row[‘lon’];

  • 0
<?
 $query = mysql_query("SELECT * FROM poi_example");
 while ($row = mysql_fetch_array($query)){
 $name=$row['name'];
 $lat=$row['lat'];
 $lon=$row['lon'];
 $desc=$row['desc'];
echo ("addMarker($lat, $lon,'<b>$name</b><br/>$desc');\n");
 }
?>

this code (echo) shows the table data in HTML source code.. is there another way (which does not shows the data) to extract markers from table?
thank you.

tutorial & demo page

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:58:05+00:00Added an answer on May 31, 2026 at 12:58 pm

    I prefer to render them as a JSON. You can either do that in-page as you have done above.

    <?php
    // do database connection here
    // run query to fetch your results
    $rows = array();
    while ($row = mysql_fetch_array($query)) {
        $rows[] = $row;
    }
    echo "<script>var items = '".json_encode($rows)."';</script>";
    

    You can iterate over your items array in JavaScript.

    for (var i = 0; i < items.length; i++) {
        (function(item) {
            addMarker(item.lat, item.lon, '<b>' + item.name + '</b><br />' + item.desc);
        })(items[i]);
    }
    

    I presume your addMarker() function creates a standard Google Map marker.

    Alternative, you can have a PHP script that fetches your items from the database as echoes them as a JSON string, and then just call that via AJAX with jQuery.

    So your PHP script would simply be:

    <?php
    header('Content-Type: application/json');
    // connect to database
    // do query
    $rows = array();
    while ($row = mysql_fetch_array($res)) {
        $rows[] = $row;
    }
    echo json_encode($rows);
    exit;
    

    And then in your JavaScript file:

    $.getJSON('script.php', function(items) {
        for (var i = 0; i < items.length; i++) {
            (function(item) {
                addMarker(item.lat, item.lon, '<b>' + item.name + '</b><br />' + item.desc);
            })(items[i]);
        }
    });
    

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$query = mysql_query(SELECT * FROM fruit WHERE color='red' ); while ($row = mysql_fetch_array($query)) {
$result = mysql_query(SELECT * FROM project ORDER BY projectid); while($row = mysql_fetch_array($result)) { return(array($row['projectid'],
$result = mysql_query('SELECT * FROM teams'); while($row = mysql_fetch_array($result)) { $team= $row['team']; $goals= $row['goals'];
$selectra_result = mysql_query(SELECT * FROM `my_selectra` WHERE user_id='$user_id') or die(mysql_error()); while($row = mysql_fetch_array( $selectra_result
$getquery = mysql_query(SELECT * FROM it_task ORDER BY task_id DESC); while ($rows = mysql_fetch_array($getquery))
$result = mysql_query(SELECT * FROM users); $values = array(); while($row = mysql_fetch_array($result)) { $values[]
<?php $result = mysql_query(SELECT * FROM articles WHERE tag='sports'); $strss=$strss+1; while ($row = mysql_fetch_array($result))
include(conn.php); $result = mysql_query(SELECT * FROM sggame); while($row = mysql_fetch_assoc($result)); { $id = $row['id'];
$query = mysql_query('SELECT * from rbf_edades_news order by month DESC '.$limit.''); month and day
a simple $stuff = mysql_query(SELECT * FROM users); while($s = mysql_fetch_array($stuff)){ # .... }

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.