Would you look at some code?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am getting the parse error message

Parse error: parse error, unexpected T_STRING, expecting T_VARIABLE or
'$' line 121

I wondered if some of you would look at this code and see if you could
find the source of it.  I have been looking at the code for an hour now
and haven't found it.  

The purpose of this is to determine if there is a pre-programmed mailing
by looking in the member_upcoming_mailings_to_do table.  If so then we
take the results of which mailing list has a pre-programmed mailing,
find out the member reference numbers from the
active_member_subscriptions and then look in the member_accounts where
their e-mail address is actually stored.  Somehow I have created the
parse error and not sure why.

Ron


#!/</usr/local/bin/php>
<?

$username="USER";
$password="PASSWORD";
$database="DATABASE";
$todays_date=DATE("Y-m-d");

#are there mailings for today

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT * FROM member_upcoming_mailings_to_do WHERE
date_to_send_out = '$todays_date'";
$mailing_result=mysql_query($query);
$number_of_mailings_to_do=mysql_numrows($mailing_result);
mysql_close();

$i=0;
while ($i < $number_of_mailings_to_do) {

$list=mysql_result($mailing_result,$i,"list");
$web_page_address=mysql_result($mailing_result,$i,"web_page_address");

#who needs to receive this mailing?  What is their account reference
number?

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT * FROM active_member_subscriptions WHERE list =
'$list'";
$subscription_result=mysql_query($query);
$number_of_subscriptions=mysql_numrows($subscription_result);
mysql_close();

$ii=0;
while ($ii < $number_of_subscriptions) {

$member_reference=mysql_result($subscription_result,
$ii,"member_reference");

#according to their account reference number what is their e-mail
address

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT * FROM member_accounts WHERE record =
'$member_reference'";
$member_result=mysql_query($query);
mysql_close();

$email = mysql_result($member_result,$iii,"email");

#according to the mailing type who is this mailing from?

if ( $list == "1" ) {

#verse of the day news and annoucements
$headers = "From: office@xxxxxxxxxxxxxxxxxx\r\n";
$mailing_description = "Verse of the Day news and annoucements ";

} elseif ( $list == "2" ) {

#e-mail edition of the Christian Discipleship Mailing List
$headers = "From: discipleship@xxxxxxxxxxxxxxxxxx\r\n";
$mailing_description = "Christian Discipleship Mailing List e-mail
edition ";

} elseif ( $list == "3" ) {

#north america edition of the Christian Discipleship Mailing List
$headers = "From: discipleship@xxxxxxxxxxxxxxxxxx\r\n";
$mailing_description = "North America Christian Discipleship ";

} elseif ( $list == "4" ) {

#over seas edition of the Christian Discipleship Mailing List
$headers = "From: discipleship@xxxxxxxxxxxxxxxxxx\r\n";
$mailing_description = "Over seas Christian Discipleship ";

} elseif ( $list == "5" ) {

#ministry news and updates e-mail list
$headers = "From: office@xxxxxxxxxxxxxxxxxx\r\n";
$mailing_description = "Ministry News and Updates ";

} elseif ( $list == "6" ) {

#for test purposes
$headers = "From: ron.piggott@xxxxxxxxxxxxxxxxxx\r\n";
$mailing_description = "Test purposes ";

}

#need to revise the reply to and return path to correspond with mailing
type later

$headers .= "Reply-To: discipleship@xxxxxxxxxxxxxxxxxx\r\n";
$headers .= "Return-Path: discipleship@xxxxxxxxxxxxxxxxxx\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

#load the file into a variable

$lineArray = file("$web_page_address");

// make an empty variable first
$message =  "";

// concat all array element
foreach($lineArray as $eachLine) {
$message .= $eachLine;
}

$subject = strstr($message, '<title>');
$subject = explode("</title>", $subject);
$subject = $subject[0];

# result has <title> at the start - now to get rid of <title>

$subject = strstr($subject, '>');
$subject = str_replace('>','',strstr($subject, '>'));

#now e-mail out the mailing

mail($email,$subject,$message,$headers);

echo $mailing_description . " mailing for " . $todays_date . " sent to
member " . $member_reference . "
";

++ii;
}

++i;
}
?>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux