Jump to content

using ajax to update data in tables with mysql


garry27

Recommended Posts

hi i'm working on this problem right now and hoping that anyone can advice me.

i've created a google map on my site which plots pubs on the map according to a predfined filter. if you click on a marker, it opens an info box.you can view an example of this at:

http://www.nl-webspace.co.uk/~unn_p921847/test5/create_crawl.php?postcode=dl3+7&=Generate+Map&lat=54.524800208734&lng=-1.5606556890128

my next task is to create a function that allows a user to click on a link on the infobox which adds the pub to a pubcrawl list on the browser. i plan to do this using the ajax approach-making asynchronous calls each time a change is made to the publist.

i can see 2 ways of doing this and i'm looking to find the easiest solution.

1. to create a new table each time a new pub is added to the list:

CREATE TABLE Pub_Crawl_Order_1(
crawlID                    INT UNSIGNED NOT NULL AUTO_INCREMENT,
entry1
entry2
entry3
entry4
...
PRIMARY KEY(CrawlID));

entries in the entry{i} value is the PubID which resides on a separate table

2. to add all orders of pub crawl data on a signle table

CREATE TABLE Pub_Crawl_Order(
crawlID                  INT UNSIGNED NOT NULL,
crawlOrder                INT UNSIGNED NOT NULL,
userEmail                VARCHAR(50) NOT NULL,
PRIMARY KEY(CrawlID));

in this case crawlOrder will contain a string of PubID's


the main concern with the first approach is in creating a new table each time a new pub crawl is made, with an appropriate name. i.e. in number increments of
Pub_Crawl_Order_{i}.

with the second approach, i'm not sure how easy it would be to swap substrings inside a single cell in order to create a pub order?

all ideas welcome?






Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.