1,105,456 Community Members

Google Maps disappear PHP

Member Avatar
tibormarias
Light Poster
43 posts since Nov 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Dear Sirs!

I have this php syntax in my <head>.

         <?php
        // MySQL
        mysql_connect("localhost", "fundis_petrol", "petrol123") or die(mysql_error());
        mysql_select_db("fundis_petrol") or die(mysql_error());

        // Table
        $result = mysql_query("SELECT * FROM  `fillingstations` LIMIT 0 , 30")
        or die(mysql_error());  


        // Print

        while($row = mysql_fetch_array($result)){
        echo $row[2];
        }

        ?>  

And I also have this JS (Google Maps API) in my <head>.

    var beaches = [
      ['Miskolci road / Shell Station', <?php echo $row[2]; ?> , 4],
      ['Szabadsag utja / Töltöallomas', 47.559025, 19.281415, 5],
      ['Cronulla Beach', -34.028249, 151.157507, 3],
      ['Manly Beach', -33.80010128657071, 151.28747820854187, 2],
      ['Maroubra Beach', -33.950198, 151.259302, 1]
    ];

But when I try to echo the number with a PHP syntax in my Javascript, the whole map disappears.
I think that it is a wrong way of outputting the number there..

I would be grateful if you could help me,

Tibor :)

LastMitch
Deleted Member
 
0
 

@tibormarias

But when I try to echo the number with a PHP syntax in my Javascript, the whole map disappears.I think that it is a wrong way of outputting the number there..

Is this question related to this other question:

http://www.daniweb.com/web-development/php/threads/440317/pass-php-string-to-js

I'm not sure why you create a new thread when you didn't post any errors in the other thread?

Member Avatar
tibormarias
Light Poster
43 posts since Nov 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

In my opinion, it's a bit different question. Now I have syntax error, in the other thread I needed a simple code. But I accept your query.

LastMitch
Deleted Member
 
0
 

@tibormarias

In my opinion, it's a bit different question. Now I have syntax error, in the other thread I needed a simple code. But I accept your query.

It does look the same

<?php
// MySQL
mysql_connect("localhost", "", "") or die(mysql_error());
mysql_select_db("") or die(mysql_error());
// Table
$result = mysql_query("SELECT * FROM `fillingstations` LIMIT 0 , 30")
or die(mysql_error());
// Print
while($row = mysql_fetch_array($result)){
echo 'Station name: '. $row[1];
echo 'LatLng: '. $row[2];
echo 'Price: '. $row[3];
}
?> 

-

var beaches = [
['Miskolci road / Shell Station', !!!!Lation!!!! 4],
['Szabadsag utja / Töltöallomas', 47.559025, 19.281415, 5],
['Cronulla Beach', -34.028249, 151.157507, 3],
['Manly Beach', -33.80010128657071, 151.28747820854187, 2],
['Maroubra Beach', -33.950198, 151.259302, 1]
];

Explain to me are you back to square 1?

Member Avatar
pritaeas
mod_pritaeas
11,317 posts since Jul 2006
Reputation Points: 1,420 [?]
Q&As Helped to Solve: 1,835 [?]
Skill Endorsements: 156 [?]
Moderator
Featured
Sponsor
 
0
 

What is in $row[2] ?

Member Avatar
tibormarias
Light Poster
43 posts since Nov 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

"47.559025,19.281415" that is in row[2] without quotation marks.

Question Answered as of 1 Year Ago by LastMitch and pritaeas
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: