Page 1 of 1

Mailing List from Database Results

Posted: Wed Sep 07, 2011 3:22 am
by busby
Hi

I have been given a task to create some SQL reports.

One of the reports is to display all the customers who have purchased a certain product based on user selection and then have those results able to be extracted to a mailing list.

So ive got the report done. Some drop down boxes allow a user to select a product and once submitted the results are then displayed.

But i dont even know where to begin with extracting those results to a mailing list. Could someone help me please? What method should I use? and where do i begin? Any code would be helpful but i think its more the method of doing this that im after mostly. BTW im a rookie with PHP/Mysql ive just got my first job since leaving university and this is a task ive been given at work so any quick and helpful replies are greatly appreciated

Thanks in advance.

Re: Mailing List from Database Results

Posted: Wed Sep 07, 2011 8:54 am
by Dorin85
I assume you are storing this data in a mysql dataqbase when the user selects their drop down boxes and submits.

1.) Query the DB for all user info.
2.) Assuming it returns as an array in this format... $result[] = array("username"=>"randomuser63", "email"=>"whatever@test.com")
3.) Iterate through the array with a foreach loop and store the data in a coma delimited string.
4.) Save that string into a csv file.