我有这样的编码
$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'];
等
答案 0 :(得分: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。
中选择全部答案 1 :(得分:0)
更改
$tampilUbahVerifikator->bindValue("idverifikator", $verifikatorId);
要
$tampilUbahVerifikator->bindValue(':idverifikator', $verifikatorId);