0

我有这样的编码

        $tampilUbahVerifikator = $app['db']->prepare("
            select p.nama_pegawai, v.id_pegawai, v.id_verifikator, v.penanggung_jawab,

            rtrim(whitelist_pembayaran || decode(whitelist_pembayaran, null, null, ', ') ||
            whitelist_pemasang || decode(whitelist_pemasang, null, null, ', ') ||
            whitelist_jenis_iklan, ', ') as whitelist,

            rtrim(blacklist_pembayaran || decode(blacklist_pembayaran, null, null, ', ') ||
            blacklist_pemasang || decode(blacklist_pemasang, null, null, ', ') ||
            blacklist_jenis_iklan, ', ') as blacklist

            from verifikator v, pegawai p
            where p.id_pegawai=v.id_pegawai and v.id_verifikator = :idverifikator

            ");
        $tampilUbahVerifikator->bindValue("idverifikator", $verifikatorId);
        $tampilUbahVerifikator->execute();
        $data_ubah_ver = $tampilUbahVerifikator->fetchAll();

如何才能获取数据库中存在的所有列?例子 :

$data['nama_pegawai'];
$data['whitelist'];

等等

4

2 回答 2

2

试试这个

$tampilUbahVerifikator = $app['db']->prepare("
    select p.*, v.*,

    rtrim(whitelist_pembayaran || decode(whitelist_pembayaran, null, null, ', ') ||
    whitelist_pemasang || decode(whitelist_pemasang, null, null, ', ') ||
    whitelist_jenis_iklan, ', ') as whitelist,

    rtrim(blacklist_pembayaran || decode(blacklist_pembayaran, null, null, ', ') ||
    blacklist_pemasang || decode(blacklist_pemasang, null, null, ', ') ||
    blacklist_jenis_iklan, ', ') as blacklist

    from verifikator v, pegawai p
    where p.id_pegawai=v.id_pegawai and v.id_verifikator = :idverifikator

    ");

注意 p.* 和 v.* 从表 p 和 v 中选择所有。

于 2012-11-23T08:14:02.383 回答
0

改变

$tampilUbahVerifikator->bindValue("idverifikator", $verifikatorId);

 $tampilUbahVerifikator->bindValue(':idverifikator', $verifikatorId);
于 2012-11-23T12:20:39.067 回答