I work for a webhosting company. I'm trying to develop a script that will eventually allow us to email all of our customers in one mass mailing. To do this, I'm doing some cross referencing with the accounts on our servers, to get the email address from our billing system. I know this may be difficult to understand, without seeing what its actually doing, but here is part of my code:
while (!feof($file)) {
$buffer = fgets($file, 4096);
$buffer=str_replace(chr(10),"",$buffer);
$buffer=str_replace(chr(13),"",$buffer);
$blah = "$buffer";
$query = "select e_mail from customers where domain_name='$buffer'";
$result = mysql_query("$query");
$row = mysql_fetch_array($result);
print("<tr><td>$buffer</td><td>$row[e_mail]</td></tr>");
(nice variable names I know).
the $file in question, is a list of the domains on one of our servers, which is how I'm cross referencing to our billing system (which is in a MySQL database). My question is, I sometimes only get 318 entries when I run this script. The $file has 362 lines (domains are listed in alphabetical order in that file, and it stops around the 'ti's). Sometimes it will show the entire file, all 362 domains, but not usually. However, in the mysql.log file you can see the queries. I suspect there is a timeout occuring somewhere, is there some variable I can change in my set up, to allow this to go through? I know that while statement above is not complete, that is just an excerpt. The script works as I intend for it to do, just that is it shows 318 domains, when it should show 362. Can anyone offer any insights on this? Any help would be greatly appreciated.
Thanks