Maybe this might work $occ->setAttribute('name', utf8_encode($row['name']));
Ralph On Sep 9, 2:13 pm, DaveGivesPHPaShot <tolman.da...@gmail.com> wrote: > Hello, I am trying to duplicate this google code tutorial on using > MySql and PHP with Google Maps V3. > > http://code.google.com/intl/fr/apis/maps/articles/phpsqlajax_v3.html > > I have foreign characters (well they aren't "foreign" for everyone, > but you know what I mean, right?) in my MySql database. > > When I call this php page > > http://www.oukwakan.org/phpsqlajax_genxml_jdm2.php > > My code breaks after <markers><marker nom="Halle de la Martini > because it's "Halle de la Martinière." (accent on the E right after > "Martini") > > I think I have to correctly specify the formatting of the XML output > file in the PHP genxml and I am not yet doing it correctly. Right ? > This problem is mentioned in the above tutorial, but my syntax must be > wrong. > > Here is my code: forhttp://www.oukwakan.org/phpsqlajax_genxml_jdm2.php > <?php > > require("phpsqlajax_dbinfo.php"); > > // Start XML file, create parent node > > $dom = new DOMDocument("1.0"); > $node = $dom->createElement("markers"); > $parnode = $dom->appendChild($node); > > // Opens a connection to a MySQL server > > $connection=mysql_connect (localhost, $username, $password); > if (!$connection) { die('Not connected : ' . mysql_error());} > > // Set the active MySQL database > > $db_selected = mysql_select_db($database, $connection); > if (!$db_selected) { > die ('Can\'t use db : ' . mysql_error());} > > // Retrieve data from Query String > $nom = $_GET['nom']; > $jour = $_GET['jour']; > $horaires = $_GET['horaires']; > $remarques = $_GET['remarques']; > $lat = $_GET['lat']; > $lng = $_GET['lng']; > $educatif = $_GET['educatif']; > // Update later - Escape User Input to help prevent SQL Injection > $age = mysql_real_escape_string($age); > $sex = mysql_real_escape_string($sex); > $wpm = mysql_real_escape_string($wpm); > //SECURITY ABOVE NEEDS TO BE UPDATED AS WE GO > //build query > $query = "SELECT * FROM jourdemarche WHERE 1"; > > //Execute query > $result = mysql_query($query); > if (!$result) { > die('Invalid query: ' . mysql_error());} > > header('Content-type: text/xml; charset=UTF-8'); > > // Iterate through the rows, adding XML nodes for each > > while ($row = @mysql_fetch_assoc($result)){ > // ADD TO XML DOCUMENT NODE > $node = $dom->createElement("marker"); > $newnode = $parnode->appendChild($node); > $newnode->setAttribute("nom",$row['nom']); > $newnode->setAttribute("descriptif", $row['descriptif']); > $newnode->setAttribute("lat", $row['lat']); > $newnode->setAttribute("lng", $row['lng']); > $newnode->setAttribute("entreprise", $row['entreprise']); > > } > > echo $dom->saveXML(); > > ?> > > Thanks for your help ! -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api...@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.