View Full Version : wow... AJAX/PHP/MYSQL 'looping' help

09-27-2008, 05:50 AM
hey everyone.
*not sure if this is the right section as it covers multiple languages*

ok.. here's what i'm trying to accomplish:

- I have a list of stores (roughly 300)
- I would like to populate a mysql db with these stores and a hyperlink associated with each store. (ie: 2 columsn, StoreName and StoreLink)
- I would like to use AJAX and PHP to query the database one row at a time and then display it to the "main.html" page

so what it does is..
id like to set it up (on main.html) so that, once a ping is finished and has returned it's result for display, it will "query" the database for the next row id, perform some task in php (i will be pinging the StoreLink) and then displaying the status of results of the php in the main.html page.

so.. ID 1 is first (Store 1 with link
the main.html page will wait till the previous results were returned then, queries the next row in the database and using the content it returns, perform the ping with php. then it returns the results of the ping to the main.html page

so... am i crazy? the reason i want to use ajax so that it can update the page without refreshing EVERYTHING. so I can go one store at a time and update them individually on the page.

i already have a ping.php which performs the ping and echo's the store name in a link format if its' online, or just the name if it's offline.

I have a Main.html that i'd like to setup with a bunch of divs to display the names once returned and a menu for the add, delete, search etc options.

what other things do i need to setup? do i do the AJAX coding in the main.html page?

PLEASE HELP! i have an idea on how to get started with it, i just get confused on how to "call the next row" instead of doing a loop.

EDIT: i'd also like to be able to add, delete, search, etc. for specific things without refreshing the page... so like.. i want to add Store 301 to the end of the list, it does its thing, and adds it to the bottom of the list