leest Posted April 25, 2008 Share Posted April 25, 2008 Ok, I have a piece of code i have modified to take results from a database and plot them on to a google map, now the code works well, however it only display one result and doesn't seem to loopthrough the xml code, i am quite new with this type of coding and so a litle confused any pointers would be much appreciated. $sql = "SELECT * FROM joborder "; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)){ $title = $row['title']; $city = $row['city']; $state = $row['state']; } {"locations": {"location":[ {"id": " echo "$title"; ", "city": " echo "$title"; ", "location": " echo "$city"; ", "address": " echo "$state"; ", "date": "May 2nd, 2007" } ] }} Quote Link to comment Share on other sites More sharing options...
fenway Posted April 25, 2008 Share Posted April 25, 2008 It's hard to see w/o proper indentation... btw, there's a UDF that does this for you. Quote Link to comment Share on other sites More sharing options...
leest Posted April 25, 2008 Author Share Posted April 25, 2008 Ok, well i guess that could be a whole lot easier, any idea where i would find it??? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted April 25, 2008 Share Posted April 25, 2008 You close your while loop after setting the variables $title,$city and $state, but before doing anything with them - hence why it doesn't loop in the way you would want. I expect fenway was referring to: http://code.google.com/apis/maps/ Quote Link to comment Share on other sites More sharing options...
leest Posted April 25, 2008 Author Share Posted April 25, 2008 Cheers, that works, i guess i will go have a look for the udf, cheers guys. Quote Link to comment Share on other sites More sharing options...
fenway Posted April 26, 2008 Share Posted April 26, 2008 Cheers, that works, i guess i will go have a look for the udf, cheers guys. mysqludf.com Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.