Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
PHP Progress

 
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> PHP
View previous topic :: View next topic  
Author Message
rassar
New one
New one


Joined: 15 Nov 2006
Posts: 1

PostPosted: Tue Nov 21, 2006 3:16 pm    Post subject: PHP Progress Reply with quote

I want to make a progress check to a php script that does this:

1. get # of records in Mysql emailing list
2. email one message
3. pause
4. goto2

THe ajax would have to do this:

1. gotoScriptSendingE-mails
2. check #totalEmails
3. check #nowSending
4. Display #nowSending/#totalEmails*100
5. wait 1 second
6. goto1

(#=number, not a typo of $)
Back to top
View user's profile Send private message
Snyke
Forum Assistant
Forum Assistant


Joined: 20 Jun 2006
Posts: 87
Location: Zurich

PostPosted: Sun Nov 26, 2006 11:30 pm    Post subject: Reply with quote

Souds a bit tricky, I personally don't know if it is possible to detach a PHP Process from the request that fired it up. Anyway, let's figure out you have some sort of background process that takes out all the email addresses and processes them one after another. Then you would have to create some interface that can be queried by the Ajax request to see if all emails are sent out. The browser would then query regularly the interface, and display the data.
_________________
[::[ Snyke.net ]::]
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
alex94040
New one
New one


Joined: 28 Jan 2007
Posts: 3

PostPosted: Tue Jan 30, 2007 9:23 am    Post subject: Reply with quote

I don't think this is difficult. You simply write a script that returns your percentage (first few steps) in some web service fashion (XML, JSON, whatever). Then you use Ajax (preferrably using some framework - XAJAX maybe) to call that web service.

To make sure the results are refreshed, just use the setInterval API in JavaScript.
Back to top
View user's profile Send private message Visit poster's website
php_penguin
New one
New one


Joined: 25 Jun 2007
Posts: 4
Location: Wales, UK

PostPosted: Tue Jun 26, 2007 10:08 pm    Post subject: Reply with quote

You know the total number of rows in the database, and you know both the first and last id's in the database.

What you could do is:

ajax <- get first ID, last ID, and total number of rows
ajax ... sizes progress bar based on total number of rows
ajax -> send first ID to server with command to send email to that ID
ajax <- server executes command and returns a status message (SUCCESS / ERROR) and the next ID to execute
ajax ... updates the progress bar
ajax -> send next ID to server with send email command

and so on, until the ID sent is the LastID from the first call.

I am aware that this method is very intensive on page loads, but it allows you to receive data on each email you send, and it can help track down any failed emails, such as might occur with an invalid address.

a further optimisation would be to auto prune addresses based on the percentage chance of success. Update the database dependent on success could let you remove the email if >5 emails failed.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> PHP All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 Advertisements
 XML & Copyright Notice 
    


Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X


Link to our site:

  


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos


Normal Bookmark


Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax


Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?


Credits:
it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert