Hi, experts,
How to change to UTF8?
I earched many forum, no good answer!
help me?
Mysql 's code is utf8_bin
webpage's code is utf8
help me, please!
the php is as follow:
<?php
require("phpsqlsearch_dbinfo.php");
// Get parameters from URL
$center_lat = $_GET["latit"];
$center_lng = $_GET["longit"];
$radius = $_GET["radius"];
// Start XML file, create parent node
$dom = new DOMDocument("1.0","UTF-8");
$node = $dom->createElement("markers");
$parnode = $dom->appendChild($node);
// Opens a connection to a mySQL server
$connection=mysql_connect (localhost, $db_user, $db_pass);
if (!$connection) {
die("Not connected : " . mysql_error());
}
// Set the active mySQL database
$db_selected = mysql_select_db($db_name, $connection);
if (!$db_selected) {
die ("Can\'t use db : " . mysql_error());
}
// Search the rows in the markers table
$query = sprintf("SELECT content, title, latit, longit, ( 6371 *
acos( cos( radians('%s') ) * cos( radians( latit ) ) *
cos( radians( longit ) - radians('%s') ) + sin( radians('%s') ) *
sin( radians( latit ) ) ) ) AS distance FROM phpmps_info HAVING
distance < '%s' ORDER BY distance LIMIT 0 , 30",
mysql_real_escape_string($center_lat),
mysql_real_escape_string($center_lng),
mysql_real_escape_string($center_lat),
mysql_real_escape_string($radius));
$result = mysql_query($query);
$result = mysql_query($query);
if (!$result) {
die("Invalid query: " . mysql_error());
}
header("Content-type: text/xml");
// Iterate through the rows, adding XML nodes for each
while ($row = @mysql_fetch_assoc($result)){
$node = $dom->createElement("marker");
$newnode = $parnode->appendChild($node);
$newnode->setAttribute("title", utf8_encode($row['title']));
$newnode->setAttribute("content", utf8_encode($row['content']));
$newnode->setAttribute("latit", utf8_encode($row['latit']));
$newnode->setAttribute("longit", utf8_encode($row['longit']));
$newnode->setAttribute("distance", utf8_encode($row['distance']));
}
echo $dom->saveXML();
?>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---