Forum Moderators: coopster & phranque

Message Too Old, No Replies

Script keeps cutting out

         

circuitjump

9:09 pm on Aug 8, 2001 (gmt 0)

10+ Year Member



Hi all,
I have a problem with my script. It's cutting off before it finishes.

I dont know what the problem could be.

Here's the Script


<?php
// DB Info
$user = "user";
$pass = "password";
$db = "database";
$link = mysql_connect( "localhost", $user, $pass );
if ( ! $link )
die ( "Couldn't connect to mySQL" );
mysql_select_db( $db, $link )
or die ( "Couldn't open $db: ".mysql_error() );

// SQL commands
$sql_select = "select email from users";
$result = mysql_query( $sql_select );

// E-Mail Content
$subject_from = "YDI Mailing List - ".$subject."\nFrom:ydi-mailinglist@ydi.com\r\n";
$blank = " ";
$message_info = $message."\n\n
--------------------------------------------------------------------\n
Visit [domain.com...] for all your wireless shopping needs.\n
You have recieved this e-mail because you signed up for it. \n
If you recieve this e-mail twice, please reply with TWICE in \n
the title in capital letters so that we may fix the problem. \n
If you would like to stop receiving emails click below \n
--------------------------------------------------------------------
[domain.com...]

// Set $count to 0
$count = 0;
while ( $mail_catch = mysql_fetch_object ($result) )
{
set_time_limit(400);
//Count how many e-mails the while loop sends to.
$count = ++$count;

$mail_users = ($mail_catch->email."<br>");

//Send the customers form e-mail.
mail($mail_catch->email,
$subject_from,
$blank,
$message_info)
or exit();

// Print out the emails it sent out to
print "(".$count.".) Sent out E-Mail to <b>".$mail_users."</b>\n";
}
// Dsiplay total of e-mails sent out
print "<br>The E-Mail was sent out to a total of   <font size=4><b>".$count."</b></font>   E-Mails.";
mysql_close( $link );
?>

circuitjump

10:20 pm on Aug 8, 2001 (gmt 0)

10+ Year Member



fixed it

David

10:55 pm on Aug 8, 2001 (gmt 0)

10+ Year Member



Any Idea at what point it cuts out ?

Good News! Guess I should have refreshed before I posted.

circuitjump

4:58 pm on Aug 9, 2001 (gmt 0)

10+ Year Member



Thanks David,

I was being a dodo head. It was cutting out because one of the e-mails in the DB was not correct, it was missing the .com from it and so it would die out.

//Send the customers form e-mail.
mail($mail_catch->email,
$subject_from,
$blank,
$message_info)
or exit();

The blue part is why I'm a dodo head.