Need good tutorial for Ajax using PHP and MySQL

835 views
Skip to first unread message

Bryn Kaufman

unread,
Jun 30, 2011, 2:24:40 PM6/30/11
to google-map...@googlegroups.com
I found http://code.google.com/apis/maps/articles/phpsqlajax_v3.html and it works fine but it only loads the data once.

Ajax is great for refreshing the data without having to reload the page, yet this demo does not show how that would be done.

I tried putting an Event Listener to load the data more dynamically but I am getting some errors so I would love to start from a working tutorial that shows how to do this.

Is there a tutorial that uses Ajax to dynamically load new data using PHP & MySQL based on an event such as when the user moves the map or clicks the mouse?

Barry Hunter

unread,
Jun 30, 2011, 7:04:25 PM6/30/11
to google-map...@googlegroups.com
Not a full tutorial, but a working example
might help?
(Its an app I made for personal use, so its not particully polished) 


--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-js-api-v3/-/dEPOJ1FyeQIJ.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Bob Torzynski

unread,
Jul 1, 2011, 6:04:17 AM7/1/11
to Google Maps JavaScript API v3
I'm not sure this is what you want, but the following link:
http://www.zgroks.com/ReadWriteMarkers.html includes a working example
that allows any user to add markers to the map and stores the markers
on an SQL database. After the marker is 'saved' to the SQL database it
displays a generic marker *until* the user re-loads the page. Then it
shows the 'new' marker. It's based on the tutorial that you cite along
with the other related one (one reads from the SQL database and one
writes to the database). It uses AJAX and PHP with v3.

This example does not show the selected icon until the page is
refreshed which sounds like what you want. However, if zoom and center
of the map were saved prior to a refresh but after the new marker was
added, it would be more responsive in terms of the AJAX refresh (as it
is when the user refreshes the map it goes to the default zoom and
center even though the new markers are added).

My apologies if this is confusing but most of the work is done in the
main javascript file which you can easily view at the linked site. The
difficult part for me was combining the two examples into a single
script into one that reads and writes. The PHP files that are used in
my example are basically exactly the same as the ones in the
example(s) you cite, so using the main script might be a starting
point for improvement to my attempt.

Regards,
Bob

On Jun 30, 2:24 pm, Bryn Kaufman <brynkauf...@gmail.com> wrote:
> I foundhttp://code.google.com/apis/maps/articles/phpsqlajax_v3.htmland it
Message has been deleted

en4ce

unread,
Jul 1, 2011, 6:17:35 AM7/1/11
to Google Maps JavaScript API v3
>>Not a full tutorial, but a working example
>>http://m.nearby.org.uk/map.php

you marker loading time is extrem! on my page its like 1 second for
3k
markers .... or maybe your server is just slow, i didn't checked the
source

i wonder why this topic pops up so often this week, if you guys dont
understand javascript / ajax html and php you gonna fail! or it will
take you a serious amount of learning... in most of the cases i think
you promised your boss or partner that you can do it and now having
trouble
just get some1 who know what hes doing and this is a matter of 1 or
2h, without copying samples together (no offence)

@bob, i really liked the zoom out part! very creative :D

bests

On 1 Jul., 12:04, Bob Torzynski <rtorzyn...@gmail.com> wrote:
> I'm not sure this is what you want, but the following link:http://www.zgroks.com/ReadWriteMarkers.htmlincludes a working example

Barry Hunter

unread,
Jul 1, 2011, 7:26:02 AM7/1/11
to google-map...@googlegroups.com
On Fri, Jul 1, 2011 at 11:15 AM, en4ce <dje...@googlemail.com> wrote:
you marker loading time is extrem! on my page its like 1 second for 3k
markers .... or maybe your server is just slow, i didn't checked the
source

Yes its not the most powerful server. The first page load does tend to be slow - as the app isnt frequented, mysql will be loading the right table from 'cold'. But once loaded, it tends to have good performance (the table is loaded and in the OS cache) 
 

en4ce

unread,
Jul 1, 2011, 9:30:17 AM7/1/11
to Google Maps JavaScript API v3
> Yes its not the most powerful server.

sure thing =)
Reply all
Reply to author
Forward
0 new messages