dlcmpls Posted June 22, 2010 Posted June 22, 2010 If use the default osC "Sign up for newsletter" feature (ticking on the box at account creation) how can I view all the people who have signed up? For example, let's say I have 1,000 customers but only 400 signed up for the newsletter. How do I view just those 400 people and their details (first name, last name, email address etc.)?
chadcloman Posted June 22, 2010 Posted June 22, 2010 If you're handy with SQL, here's the query string to get what you want: SELECT customers_firstname, customers_lastname, customers_email_address FROM customers WHERE customers_newsletter = '1' Inside osCommerce, it would be something like this: $html_output = "\n<table>\n"; $query_str = "SELECT customers_firstname, customers_lastname, customers_email_address FROM " . TABLE_CUSTOMERS . " WHERE customers_newsletter = '1'"; $query = tep_db_query($query_str); while (($row = tep_db_fetch_array($query))) { $html_output .= "<tr>\n"; $html_output .= "<td>" . htmlspecialchars($row['customers_firstname']) . "</td>\n"; $html_output .= "<td>" . htmlspecialchars($row['customers_lastname']) . "</td>\n"; $html_output .= "<td>" . htmlspecialchars($row['customers_email_address']) . "</td>\n"; $html_output .= "</tr>\n"; } $html_output .= "</table>\n"; Then you just place this code where you want the info to be output: echo $html_output; NOTE: I haven't actually tested this code, so there may be syntax errors. Check out Chad's News.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.