Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
mail() and mysql_fetch_array() problem
Old 04-14-2005, 01:05 AM mail() and mysql_fetch_array() problem
Skilled Talker

Posts: 61
Trades: 0
I have a mailing list script that functions fine in terms of sending the emails to all address in the database, but it includes a single name with all the emails.

The code is below. I have no clue what's going on. Anyone have any ideas? Thanks in advance.

PHP Code:
$query_review mysql_query("SELECT * FROM pmenu_review_list");           
        while(
$mailstat_re mysql_fetch_array($query_review)){
            
$review_name $mailstat_re[name];
            
$review_email $mailstat_re[email];
            
            
$message_review "";
        
        
mail($review_email,$subject,$message_review,$headers);
        } 

Last edited by gregory; 08-19-2005 at 12:48 AM..
gregory is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-14-2005, 08:39 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
Trades: 0
First of all if you had 10,000 users then you would have to (in the method above) send 10,000 seperate emails and this (going on the method above) would meen 10,000 calls to sendmail (if this was the program).

Thats drastic on the server.

Instead you should bcc your list and send approx 100 at a time (some servers don't even allow this many). Also you can split your mailing list down into days. So everyone who has a last name starting with A to H gets amailed on day one H to M day 2 etc.

Of course people do things differently but mostly for the same reasons.

As for your query

$mailstat_re[name] should be called as $mailstat_re['name'] this then would return Joe Bloggs instead of name.

Ibbo
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Linux user #349545 :
(GNU/Linux)iD8DBQBAzWjX+MZAIjBWXGURAmflAKCntuBbuKCWenpm XoA7LNydllVQOwCf
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Old 04-14-2005, 11:37 AM
Skilled Talker

Posts: 61
Trades: 0
Yeah, I'm realy behind on updating it since I know the current method is not ideal and very slow/taxing.

But the array isn't actually printing "name"; it's including a name from a table row different from the row of the email. In other words, say this is the DB table:

------------------------------------
name | email
---------------------------------
greg | greg@com.com
-----------------------------------
joe | joe@com.com
-----------------------------------
bill | bill@com.com
-----------------------------------

What's happening is Joe's name is ending up in the emails sent to greg, joe and bill.

Last edited by gregory; 08-19-2005 at 12:49 AM..
gregory is offline
Reply With Quote
View Public Profile
 
Old 04-14-2005, 11:48 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
Trades: 0
Hmmmm

Thats very bizarre, and quite frankly with the statement you have it should not do that at all. I have a similar problem on one of my sites where the previous listings URL will appear in the following ones. Very anoying and as of yet i cant fathom whats wrong.

Good luck with it

Ibbo
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Linux user #349545 :
(GNU/Linux)iD8DBQBAzWjX+MZAIjBWXGURAmflAKCntuBbuKCWenpm XoA7LNydllVQOwCf
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Old 04-14-2005, 04:35 PM
rvarcher's Avatar
Novice Talker

Posts: 5
Location: OKC, OK
Trades: 0
Nothing appears to be wrong with your code.

Have you verified the data in your database? The names are different in the database, right?

- bob
rvarcher is offline
Reply With Quote
View Public Profile Visit rvarcher's homepage!
 
Old 04-18-2005, 01:07 AM
Skilled Talker

Posts: 61
Trades: 0
Yeah, data is all solid in the db.
gregory is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to mail() and mysql_fetch_array() problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17326 seconds with 12 queries