0

我想将 $comment 变量附加到 $notes 变量并更新 LX 表,而不覆盖 LX 表的 note1 字段内的当前数据。所以我用当前的笔记数据($notes)创建了一个变量,并在更新时为特定帐户设置了 $notes + $comments ......这实际上是正确的解决方案吗?

$patient_ids = $_POST['patient_ids'];
    $comment = strtoupper($_POST['comment']); 
    foreach($patient_ids as $id)
        {
        $patient = new patient($id);
        $patient->insertComment(array('note'=>$comment));


    $ltc_rx_event_id = sql::value ("SELECT id FROM ev.do.ent
                                  WHERE task_id = 'LX' and status = 1 and patient_id = $patient->hex");

    $notes = sql::value("Select note1 FROM ev.do.ent
                        Where task_id = 'LX' and status = 1 and patient_id = $patient->hex");

    sql::query("update ev.do.LX set $notes + $comment where event_id = $ltc_rx_event_id");      
    }

echo "<h3 class='passed'>Comment has been added to " . count($patient_ids) . " patient(s)</h3>";

我觉得它应该可以工作,我只是想知道是否有一些我遗漏或忽略的东西,以及我的语法是否正确,使用“+”号附加?另外,我必须连接吗?感谢您的帮助,非常感谢。

4

1 回答 1

1

你可能想读这个。它将为您节省一些代码。

http://www.plus2net.com/sql_tutorial/concat.php

于 2013-03-13T23:30:30.697 回答