Ive been trying to solve some issues for implementing google maps with the api using this guidehttp://code.google.com/intl/no-NO/apis/maps/articles/phpsqlajax_v3.html.
Im stuck at this part: modifying the query with a variable set in another document or in the same document with processing of server basename like this:
*(this is the php file that generates the xml file:http://gmaps-samples-v3.googlecode.com/svn/trunk/articles/phpsqlajax/phpsqlajax_genxml3.php)*
$mapid = str_replace(".php","",basename($_SERVER['REQUEST_URI']));
$query = "SELECT * FROM markers WHERE type='".$mapid."'";
This doesnt work…
Also it doesn’t work if i set the variable in the main webpage.php file that displays the map eighter… it works if i set the variable in the same file (xmlgenerate.php) like this:
$mapid = "mymap";
$query = "SELECT * FROM markers WHERE type='".$mapid."'";
Hope someone can tell me what im doing wrong here.
edit: Heres a link to the live files btw. xmlgenerate=> http://www.pinnedmap.com/mapdata.php and mappage=> http://www.pinnedmap.com/test.php NB. a valid query example is: wondersoftheworld
to pass the variable from test.php would be ideal.
I don’t understand what you’re trying to do here:
Instead try this:
(The
mysql_real_escape_stringpart prevents a SQL injection)Now just request your file like
file.php?mapid=somethingand everything should work…