<?php
include ('php/database.php');
$db = new db;
$data = $db->query("select id, title from dha_emails order by title asc");
$txt = '';
while ($email = mysqli_fetch_assoc($data[0])){
$txt .= "{id : {$email['id']} , title :\"{$email['title']}\"},";
}
$txt = trim($txt,",");
echo "emails = Array ($txt);";
?>