Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Name: smbotans
hi all,
i have a client whose server has been updated to php 5.2.0-8 and now this script, which is used ot send out a newsletter, has 2 problems:
1. it is caught in a loop whenever it is run and never seems to stop
2. the emails sent out come back to his own email box as undeliverable
can someone who knows php 5.2.0-8 please look at the script and see what is causing all this ... i can do basic php but this is beyond me
some things you might like to know about the server:
- php 5.2.0-8
- mysql Ver 14.12 Distrib 5.0.32, for pc-linux-gnu (i386) using readline 5.0
- Sendmail Path : /usr/sbin/sendmail
==============================
<?php# Include the DB details
require_once('../../connect_db.php');$subject = $_POST['subject'];
$messagecontent = $_POST['message'];echo 'Sending E-mails:</br>';
# Create recordset
$colname_rsInstructors = "1";
$query_rsInstructors = sprintf("SELECT i_email, i_username, i_password FROM instructors;", $colname_rsInstructors);
$rsInstructors = mysql_query($query_rsInstructors, $conn) or die ('Could not connect to database because: ' . mysql_error());
$row_rsInstructors = mysql_fetch_assoc($rsInstructors);
$totalRows_rsInstructors = mysql_num_rows($rsInstructors);do {
$sql = mysql_query("SELECT i_email, i_password, i_username
FROM instructors;")
or die ('Select failed because: ' . mysql_error());# Set variables from the record set
$email = $row_rsInstructors['i_email'];
$user = $row_rsInstructors['i_username'];
$password = $row_rsInstructors['i_password'];
$messagefooter = "This E-mail has been sent to you as a registered member of the Driving Lesson Booking
Service<br />
http://www.DLBS.co.uk. <br />
To amend your details you can login at http://www.dlbs.co.uk
with the user name $user and password $password.";
$message = "$messagecontent $messagefooter";
# Send email
# @mail($email, $subject, $message, "From: info@dlbs.co.uk");
@mail($email, $subject, $message,
"From: DLBS.co.uk <newsletter@dlbs.co.uk>\r\nMIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\n");
echo'E-mail sent to : '.$email. '
';
} while ($row_rsInstructors = mysql_fetch_assoc($rsInstructors));
echo ' All Emails Sent!</br>';
echo 'Back to Admin Home Page';
?>=======================================
a huge thank you in advance :-)))))
serge
Keep mentally active.
SEO ANALYSIS Discover what search engines really think of your web site.

Hi
I'm sorry but i can't really test this. but here is some amended code that i think should work.
<?php
# Include the DB details
require_once('../../connect_db.php');$subject = $_POST['subject'];
$messagecontent = $_POST['message'];echo 'Sending E-mails:</br>';
# Create recordset
$colname_rsInstructors = "1";
$query_rsInstructors = sprintf("SELECT i_email, i_username, i_password FROM instructors;", $colname_rsInstructors);
$rsInstructors = mysql_query($query_rsInstructors, $conn) or die ('Could not connect to database because: ' . mysql_error());
$row_rsInstructors = mysql_fetch_assoc($rsInstructors);
$totalRows_rsInstructors = mysql_num_rows($rsInstructors);
while ($row_rsInstructors = mysql_fetch_assoc($rsInstructors)){
$sql = mysql_query("SELECT i_email, i_password, i_username
FROM instructors;")
or die ('Select failed because: ' . mysql_error());# Set variables from the record set
$email = $row_rsInstructors['i_email'];
$user = $row_rsInstructors['i_username'];
$password = $row_rsInstructors['i_password'];$messagefooter = "This E-mail has been sent to you as a registered member of the Driving Lesson Booking
Service<br />
http://www.DLBS.co.uk. <br />
To amend your details you can login at http://www.dlbs.co.uk
with the user name $user and password $password.";$message = "$messagecontent $messagefooter";
# Send email
# @mail($email, $subject, $message, "From: info@dlbs.co.uk");
@mail($email, $subject, $message,
"From: DLBS.co.uk <newsletter@dlbs.co.uk>\r\nMIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\n");
echo'E-mail sent to : '.$email. '
';}
echo ' All Emails Sent!</br>';
echo 'Back to Admin Home Page';?>
let me know how this goes.
-Cody Joyce
PHP Developer / Technician

thanks for your reply and time to look into this ... after a couple of days of no replies at this forum, i turned to a friend in poland who fixed it for me ... according to him, the code did not work because of that section:
while ($row_rsInstructors = mysql_fetch_assoc($rsInstructors)){
$sql = mysql_query("SELECT i_email, i_password, i_username
FROM instructors;")
or die ('Select failed because: ' . mysql_error());thanks again for your help
serge
Keep mentally active.
SEO ANALYSIS Discover what search engines really think of your web site.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |