Splitting data in text box - send emails to each individualy

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

cvmflinchy
Forum Newbie
Posts: 13
Joined: Sat Feb 06, 2010 12:58 pm

Re: Splitting data in text box - send emails to each individualy

Post by cvmflinchy »

if i just have while then it just repeats and repeats none stop.
If i change it to forloop what do i put in the brackets because theres no "as" command in while?
User avatar
a.heresey
Forum Commoner
Posts: 59
Joined: Wed Dec 13, 2006 7:31 pm
Location: Chesapeake, VA, US

Re: Splitting data in text box - send emails to each individualy

Post by a.heresey »

I'm confused by your database code

Code: Select all

 
$rs = $oAppl->query($q);
while($rw = $oAppl->row($rs)){
 
This is how I would do it using mysqli

Code: Select all

 
$oAppl = new mysqli('localhost','username','password','database');
$q = "SELECT DISTINCT email FROM orders";
$rs = $oAppl->query($q);
while($rw=$rs->fetch_row();){
$to1=$rw['email'];
//send email stuff
}
 
 
cvmflinchy
Forum Newbie
Posts: 13
Joined: Sat Feb 06, 2010 12:58 pm

Re: Splitting data in text box - send emails to each individualy

Post by cvmflinchy »

its because the same database is called for a lot of things from several pages so its in all that code you posted is in a require db.php in the pages.
The code works. but when i run it with only while($rw... it seems to repeat none stop when i have the code for while and foreach it only loops round twice. i just need to get it to do it once.
Post Reply