View Full Version : Popup showing database and script progression

05-05-2006, 04:56 AM
I want to create a script that will send a mass email to all of the people in a specific table in my database. I have a mysql table that stores:


along with other things, I want the script to look through the table and list all of the people, then start running through and sending emails one at a time. When it is done with each email, i want it to put a checkmark next to the row of the username and email that it sent. Then at the top center of the popup, have a percentage bar that updates for how much percent of the total emails it has sent. This project is mainly javascript, which is something that i can edit code for, but I am not completely profecient at it.

So what I would like, is some help putting this together using php, and ajax. Can someone post a snippit or something that would help me out in doing this?

05-07-2006, 04:38 AM

05-07-2006, 09:51 AM

Take a look at one/some of those, try implementing them and come back with specific questions?

05-07-2006, 03:14 PM
i am not trying to upload a file, and i couldn't find a site that shows how to use ajax for general script progression.

05-09-2006, 06:06 AM

05-09-2006, 01:27 PM

05-09-2006, 03:26 PM
Okay, I know it sounds like I don't want to do any work, but I learn best from specific examples that show me my final goal. I have found many ajax websites now that have progress bars, but I need some sort of example that does what I want it to do, for me to be able to work with it, and make it bigger. So I am now going to specifically going to ask for someone to write me a basic code, so that I can start somewhere. Please don't see this as me not wanting to do anything on my own. Thank you.

05-10-2006, 03:28 PM
*bump* Can anyone help me out at all please.

05-10-2006, 03:46 PM
Assuming that you know everything up to the point of showing the percentage... you'd need two queries to get the percentage.
One would be to get the number of all the users that will get a mail.

SELECT COUNT(`primary_key`) AS `total_users` FROM `table`;
# I assume every user is being mailed.

The other one would be the number of users who already got the email.

SELECT COUNT(`primary_key`) AS `emailed_users` FROM `table` WHERE `was_emailed` = 1;

The first query only needs to be run once and the second one evertime when you want to check for the percentage.
You calculate the percentage simply by

$emailed_users / $total_users * 100

05-11-2006, 01:31 AM
no, i can do the math. The math im fine at, what I am not good at is the general javascript to power this.

05-11-2006, 11:10 AM
Prototype has a nifty 'updater' function/class that means you can specify the id of an HTML element (a div for example) and a url, and then every X seconds (you specify this too) the url will be called (in the background) and whatever it returns gets put in the specified div.

05-11-2006, 07:45 PM
no, i can do the math. The math im fine at, what I am not good at is the general javascript to power this.
The javascript forum is right at the top of the board.