I am trying to debug a newsletter mailing script for a project I am working on. This used to work perfectly fine with PHP Mailer, however I ended up changing my mailer to Swift Mailer and since I have been having the most bizarre problem.
I keep getting the following warning, after the first iteration of the while loop (one e-mail is sent out to the first e-mail address in the mysql result set, then I get this warning):
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, integer given in /home1/username/public_html/domain/newslettermailer.php on line 15
I have been trying to debug this for quite a while now and am really having a difficult time with this, I appreciate any suggestions as to why this is happening.
Many thanks in advance!
Solution
You're reusing the variable $result:
$result = $mailer->send($message);
So on the second iteration of the while loop, it's trying to pass that to mysqli_fetch_array() instead of the result return from mysqli_query().