guymclaren Posted September 21, 2008 Share Posted September 21, 2008 $mail = " SELECT id FROM invite WHERE sentcode = '1' ORDER BY id ASC"; $rec = mysql_query($mail) or die(mysql_error()); $row = mysql_fetch_assoc($rec); while ($row != Null){ $email = $row['email']; $fname = $row['fname']; //send email// } Link to comment https://forums.phpfreaks.com/topic/125172-solved-while-loop-will-this-work/ Share on other sites More sharing options...
Minase Posted September 21, 2008 Share Posted September 21, 2008 thats totaly wrong instead of while you need IF but if i understood corectly you want to loop through all records from DB ? Link to comment https://forums.phpfreaks.com/topic/125172-solved-while-loop-will-this-work/#findComment-646961 Share on other sites More sharing options...
JasonLewis Posted September 21, 2008 Share Posted September 21, 2008 Why don't you try it for yourself. It's not going to blow up, so you may as well give it a shot. But, as Minase said, you may want this: $mail = " SELECT id FROM invite WHERE sentcode = '1' ORDER BY id ASC"; $rec = mysql_query($mail) or die(mysql_error()); while ($row = mysql_fetch_assoc($rec)){ $email = $row['email']; $fname = $row['fname']; //send email// } Link to comment https://forums.phpfreaks.com/topic/125172-solved-while-loop-will-this-work/#findComment-646962 Share on other sites More sharing options...
guymclaren Posted September 21, 2008 Author Share Posted September 21, 2008 I figured I would get guidance because ASP works so differently, I am actually rewriting something I did a while ago in ASP but for reasons of insanity now require in PHP. Thanks for the help Link to comment https://forums.phpfreaks.com/topic/125172-solved-while-loop-will-this-work/#findComment-646970 Share on other sites More sharing options...
PFMaBiSmAd Posted September 21, 2008 Share Posted September 21, 2008 The best way to learn something is to try it and see what the results are. If the result are what you expect, than your understanding is correct. If not, then you need to try again. Link to comment https://forums.phpfreaks.com/topic/125172-solved-while-loop-will-this-work/#findComment-646999 Share on other sites More sharing options...
guymclaren Posted September 21, 2008 Author Share Posted September 21, 2008 NSS, I do that, occassionally when I am unsure I will ask a stupid question and get an even less satisfactory answer. Thank you to those that helped. Link to comment https://forums.phpfreaks.com/topic/125172-solved-while-loop-will-this-work/#findComment-647040 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.