Page 2 of 2

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

Posted: Tue Feb 09, 2010 5:18 pm
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?

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

Posted: Tue Feb 09, 2010 5:47 pm
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
}
 
 

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

Posted: Tue Feb 09, 2010 6:25 pm
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.