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 に答える