我想将$comment变量附加到$notes变量上,并在不覆盖LX表的note1字段中的当前数据的情况下更新LX表。所以我创建了一个变量与当前的笔记数据($notes)和更新后,我设置$notes + $评论的特定帐户…这真的是正确的解决方案吗?
$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>";
我觉得它应该工作,我只是想知道是否有我错过或忽视的东西,如果我的语法是正确的使用"+"符号追加?另外,我必须连接吗?谢谢你的帮助,我非常感激。
你可能想读一下。这将为您节省一些代码。
http://www.plus2net.com/sql_tutorial/concat.php