> But that isn't the problem that i'm dealing with. That was a code
> misplace that it is solved right now.

Ah good, that helps the helpers a lot when you have known problems
other the one you're asking about.

> The problem is that I cannot read from my database using javascript.

That's right, you can't.  You have to send the parameters to a php
script and get that script to read the database, and return the data
to the javascript.

> I want to get 2 coordinates from my database and calculate distance
> between them and the new ones that I'm saving.

In your code, there already is an example of reading from database and
sending data to the javascript.
'phpsqlinfo_dbinfo.php' does the reading.
$query1 = sprintf("Select clat from pics where id=1");
  $result1 = mysql_query($query);

That embeds some data in the generated HTML page like
      var Gpoint1= new Glatlng(<?php echo($result1); ?>, ...
which I guess is supposed to be the 'old' point you want to use to
calculate the distance to the new point?  You don't say.  If it is,
you can calculate the distance in the javascript easily.

I guess that line was giving you problems, because in your live
example you've commented it out.

First thing is to look closely at new Glatlng(...
Compare it to other things in your script that DO work, like new new
GLatLng(...
javascript is case-sensitive.

Next thing is to look and see what data the php actually inserted into
your webpage script before it got sent to the browser.
Using 'view source' in your browser is a really useful tool to see
what arrives.
In this case, we see
   var Gpoint1= new Glatlng(, );
aha - the php data didn't get inserted properly.

Go back and look at the php script.
   $result1 = mysql_query($query);
the result is a raw MySQL result ; it's not simple text strings, or
numbers
      var Gpoint1= new Glatlng(<?php echo($result1); ?>, ...
will fail because php can only usefully echo text or numbers into a
webpage like that, not complex MySQL result sets.

Go back and look at the php/MySQL examples again, and look to see
where they useful text into strings by php coding.

Not a maps API issue, not even a javascript issue.

cheers. Ross K
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to