使用动作邮件程序在rails中配置圆形多维数据集

时间:2015-12-07 13:11:01

标签: ruby-on-rails email actionmailer

如何使用rails应用程序配置roundcube邮件服务? 写下production.rb所需的代码,我正在尝试以下代码:

$fields = array('first_name', 'last_name', 'email', 'job', 'country', 'city');
$inputParameters = array();

foreach ($fields as $field) {
    // don't forget to validate the fields values from $_POST
    if (!empty($_POST[$field])) {
        $inputParameters[$field] = '%' . $_POST[$field] . '%';
    }
}

$where = implode(' OR ', array_map(function($item) {
    return "`$item` LIKE :$item";
}, array_keys($inputParameters)));

$search = $db->prepare("SELECT `id`, `name` FROM `users` WHERE $where");
$search->execute($inputParameters);

foreach ($search->fetchAll(PDO::FETCH_ASSOC) as $row) {
    var_dump($row);
}

0 个答案:

没有答案