ChompGator Posted February 15, 2008 Share Posted February 15, 2008 What Iam trying to do is just get one column of my table in phpmyadmin that stores email address to just list all the email address in the 'email' column. Im trying to get just the email addresses listed on the page so I can copy/paste them into an email. The easiest way I know to do this is just get my php script to list the email address on the page so I can copy them all. Is there an easier way to do this, perhaps get php to copy it to a text file or something? Anyway there is 150 email addresses in the column so I figured itd be easy to just get a php script to list all the email address so I can copy them. Here is my script, what is wrong with this? Its not listing anything when I upload it <?php $con = mysql_connect("******","******","******") or die('Could not connect: ' . mysql_error()); mysql_select_db("login", $con); $result = mysql_query("SELECT * FROM subscribe"); while($row = mysql_fetch_array($result)) { $row['email']; } mysql_close($con); ?> Quote Link to comment Share on other sites More sharing options...
jscix Posted February 15, 2008 Share Posted February 15, 2008 <?php $con = mysql_connect("******","******","******") or die('Could not connect: ' . mysql_error()); mysql_select_db("login", $con); $result = mysql_query("SELECT * FROM subscribe"); if (!is_array($result)) { die("Result returned non-array"); } while($row = mysql_fetch_array($result)) { print ($row['email'] . "<br>"); } mysql_close($con); ?> Quote Link to comment Share on other sites More sharing options...
ChompGator Posted February 15, 2008 Author Share Posted February 15, 2008 Thank you _ Quote Link to comment Share on other sites More sharing options...
ChompGator Posted February 15, 2008 Author Share Posted February 15, 2008 Ok, geeze one problem, its listing the email address, is there a way to make it list the email address and put a comma between each one, for copy.pasting purposes? Actualy, I think its a semi colon that separates email address, so it'd have to be a semi colon, but be that as it may - is there a way to do this? Quote Link to comment Share on other sites More sharing options...
jscix Posted February 15, 2008 Share Posted February 15, 2008 I hope this is for legit purposes <?php $con = mysql_connect("******","******","******") or die('Could not connect: ' . mysql_error()); mysql_select_db("login", $con); $result = mysql_query("SELECT * FROM subscribe"); if (!is_array($result)) { die("Result returned non-array"); } while($row = mysql_fetch_array($result)) { $emails .= ($row['email'] . ","); } print ($emails); mysql_close($con); ?> Quote Link to comment Share on other sites More sharing options...
ChompGator Posted February 15, 2008 Author Share Posted February 15, 2008 haha, it is. What is happening is, Im on the board for an organization and we're sending out an monthly newsletter, and this is the only way I know of to get a list of registered members, to send the newsletter to. I posted a topic weeks back, about any good Mailing systems, or tutorials on how to create one for my website, but the topic didn't get any replies. Basically, though Ive thought about it, and it probably isn't that hard is it? Itd be pretty much creating a login (Which is done) and having a link for board members to click, 'Create NewsLetter' allow them to type their content, and then hit send, and have it automatically send off the server right? But Im unsure as to how to using the sending feature with php, I could probably figure it out, but my whole thing is this, the reason Id like someone to recommend a good tutorial for me to create a NewsLetter system like this is because, I want to be able to add graphics to the newsletter where necessary. But then I read if I create the newsletter in Microsoft Publisher it has an email function on it, so I can just hit 'email' and enter the addresses and it will email the newsletter in HTML format. So Im not sure what the most efficient way to creat a newsletter system is. - Thanks for the help! Ps if you know any good tutorials, let me know! Quote Link to comment Share on other sites More sharing options...
ChompGator Posted February 15, 2008 Author Share Posted February 15, 2008 With the above script to seperate the email addresses with a semi-colon, Im getting a message now saying "Results returned a non-array" Quote Link to comment Share on other sites More sharing options...
ChompGator Posted February 15, 2008 Author Share Posted February 15, 2008 With the above script to seperate the email addresses with a semi-colon, Im getting a message now saying "Results returned a non-array" Then I got a result that said, "No Results" Now, Im getting the "Results Returned A Non-Array" again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.