MyBB Community Forums

Full Version: Exporting email addresses.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
The systems mass email function isn't strong enough for me to do a newsletter. Is there a way to export all my users email addresses so I can use a newsletter program?
Create a php file in your root directory with these contents:
<?php
define("IN_MYBB",1);
include("global.php");
$result = $db->query("SELECT * FROM ".TABLE_PREFIX."users")

while ($row = $db->fetch_array($result, MYSQLI_NUM)) {
echo $row['email']."<br />";
}
?>

Excecute it and it should echo all email addresses.
(2011-10-07, 12:37 AM)Paul H. Wrote: [ -> ]Create a php file in your root directory with these contents:
<?php
define("IN_MYBB",1);
include("global.php");
$result = $db->query("SELECT * FROM ".TABLE_PREFIX."users")

while ($row = $db->fetch_array($result, MYSQLI_NUM)) {
echo $row['email']."<br />";
}
?>

Excecute it and it should echo all email addresses.

Parse error: syntax error, unexpected T_WHILE in /home/bf4br419/public_html/forum/email.php on line 6
^ add a semicolon at end of line 4 , that is after $result = $db->query("SELECT * FROM ".TABLE_PREFIX."users")
(2013-08-01, 08:12 AM).m. Wrote: [ -> ]^ add a semicolon at end of line 4 (after $result = $db->query("SELECT * FROM ".TABLE_PREFIX."users"))



<?php
define("IN_MYBB",1);
include("global.php");
$result = $db->query("SELECT * FROM ".TABLE_PREFIX."users"))

while ($row = $db->fetch_array($result, MYSQLI_NUM)) {
echo $row['email']."<br />";
}
?>


Like this?



Another error

Parse error: syntax error, unexpected ')' in /home/bf4br419/public_html/forum/email.php on line 4
^
<?php
define("IN_MYBB",1);
include("global.php");
$result = $db->query("SELECT * FROM ".TABLE_PREFIX."users");

while ($row = $db->fetch_array($result, MYSQLI_NUM)) {
echo $row['email']."<br />";
}
?>
I copy and create the file but it's white page, it's normal?
oh! you can use code like below
<?php
define("IN_MYBB",1);
include("global.php");
$result = $db->query("SELECT * FROM ".TABLE_PREFIX."users");
while ($row = $db->fetch_array($result)) {
echo $row['email']."<br />";
}
?>
just replace it?
^ yes. you can use that code in a php file, upload it to your MyBB files server (where you have global.php file) & execute it
Pages: 1 2