0

使用下拉菜单,无论选择什么项目,我都想将自定义注释添加到我的数据库中的表中。

如果我像这样传递一个字符串,它工作正常:即。选择数量覆盖

if ($this->call_type) sql::query("insert into PWARE.ADS.STACRD (ACCOUNT,ENTRYDATETIME,CATEGORY,NOTE,LOGCODE) VALUES (" . $this->patient->hex .",getdate(),'','QTY OVERRIDE SELECTED'," . login::$hex . ")");

但是当我使用$tc变量时,我没有得到我想要的结果。

这是我的代码:

function npc_call_type_status()
        {
        $tc = "($this->call_type == 'PO' ? 'OK - PENDING PO' 
        :($this->call_type == 'IN' ? 'OK - PENDING INS'
        :($this->call_type == 'PI' ? 'OK - PENDING INS/PO'
        :($this->call_type == 'NC' ? 'OK - NO CHANGES'
        : ''))))";  
        if ($this->call_type) sql::query("insert into PWARE.ADS.STACRD (ACCOUNT,ENTRYDATETIME,CATEGORY,NOTE,LOGCODE) VALUES (" . $this->patient->hex .",getdate(),'',".$tc."," . login::$hex . ")");
        }

任何和所有的帮助将不胜感激。谢谢你。

4

1 回答 1

1

您需要从 $tc 中删除引号。

$tc = ($this->call_type == 'PO' ? 'OK - PENDING PO' 
    :($this->call_type == 'IN' ? 'OK - PENDING INS'
    :($this->call_type == 'PI' ? 'OK - PENDING INS/PO'
    :($this->call_type == 'NC' ? 'OK - NO CHANGES'
    : ''))));
于 2013-06-05T17:46:05.290 回答