Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-01-2013, 03:20 PM   PM User | #1
ilder
New to the CF scene

 
Join Date: Aug 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ilder is an unknown quantity at this point
world map markers

Hi everyone,

I'm using jvectormap to create an interactive world map that shows alumni associated with the university I work for. However, I've come across a bit of a stumbling block. I'm using php to connect to a database with a list of countries and their respective co-ordinates. However, it's not working as when I inspect the page source nothing appears to be written.

Here is the php (after it's connected to the database, which is fine):

mysql_select_db("xxxxxx", $con);
$sql="SELECT * FROM alumni-countries";
$result = mysql_query($sql, $con); //used for country

echo "markers: [";

while($row = mysql_fetch_array($result))
{
if ($result) {
echo "{latLng: [" . $row['Coords'] ."], name: '" . $row['Country'] . "'},";
} else {
echo "No data!";
}
}
echo "],";

mysql_close($con);

?>

The finished results should come out something like this:

markers: [
{latLng: [41.50, 87.37], name: 'Chicago'},
],

If any of you can help me with this issue it would be greatly appreciated, I'm pulling my hair out over it at the minute!

Cheers,

ilder

Last edited by ilder; 02-01-2013 at 03:39 PM..
ilder is offline   Reply With Quote
Old 02-01-2013, 05:13 PM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,376
Thanks: 18
Thanked 350 Times in 349 Posts
sunfighter is on a distinguished road
This should output something. The lest should be "markers: [". That it is not echoing anything kinda means the code is not being executed at all. See what is interfering with calling this code.
sunfighter is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:56 AM.


Advertisement
Log in to turn off these ads.