我的文件 optherapie.php 包含以下PHP和HTML代码:
<?php
[...]
if ($_POST['cbOP2Revision'] == '2') {
$optherapie->setOP2Revision($_POST['cbOP2Revision']);
$OP2RevisionIndikation = implode(', ', $_POST['cbOP2RevisionIndikation']);
$optherapie->setOP2RevisionIndikation($OP2RevisionIndikation);
$OP2RevisionArt = implode(', ', $_POST['cbOP2RevisionArt']);
$optherapie->setOP2RevisionArt($OP2RevisionArt);
//$optherapie->setOP2RevisionIndikation($_POST['cbOP2RevisionIndikation']);
//$optherapie->setOP2RevisionArt($_POST['cbOP2RevisionArt']);
}
[...]
?>
[...]
<div id="OP2_RevisionIndikationArt" style="display:none">
<table width="95%" align="center" border="<?= $BORDER_TABLE ?>" cellpadding="0" cellspacing="0" frame="" style="margin-left: 40px;" >
<colgroup>
<col style="width: 185px" />
<col />
</colgroup>
<tr>
<td class="tablecontent" style="background-color: <?= $DATA_COLOR ?>;" >
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation', 'Indication') ?>
</td>
<td class="tablecontent" style="background-color: <?= $DATA_COLOR ?>;">
<select id="op2revindselect" name="cbOP2RevisionIndikation[]" multiple="multiple" data-placeholder="Mehrfachauswahl durch Ctrl/Strg + LMausClick ...">
<!-- <option><?= $oLanguage->getExpression('optherapy', 'revisionIndikationChoice', 'revision surgery - please choose') ?></option> !-->
<option value="1" <?= $optherapie->getOP2RevisionIndikation() == '1' ? 'selected' : '' ?>><?= $oLanguage->getExpression('optherapy', 'revisionIndikation1', 'Inner Hernia (Meso)') ?></option>
<option value="2" <?= $optherapie->getOP2RevisionIndikation() == '2' ? 'selected' : '' ?>><?= $oLanguage->getExpression('optherapy', 'revisionIndikation2', 'Inner Hernia (PETERSON)') ?></option>
<option value="3" <?= $optherapie->getOP2RevisionIndikation() == '3' ? 'selected' : '' ?>><?= $oLanguage->getExpression('optherapy', 'revisionIndikation3', 'Weight Regain') ?></option>
<option value="4" <?= $optherapie->getOP2RevisionIndikation() == '4' ? 'selected' : '' ?>><?= $oLanguage->getExpression('optherapy', 'revisionIndikation4', 'Weight Loss Failure') ?></option>
[...]
<option value="17" <?= $optherapie->getOP2RevisionIndikation() == '17' ? 'selected' : '' ?>><?= $oLanguage->getExpression('optherapy', 'revisionIndikation17', 'Leakage') ?></option>
</select>
</td>
</tr>
<tr>
<td class="tablecontent" style="background-color: <?= $DATA_COLOR ?>;" >
<?= $oLanguage->getExpression('optherapy', 'revisionArt', 'Type') ?>
</td>
<td class="tablecontent" style="background-color: <?= $DATA_COLOR ?>;">
<select id="op2revartselect" name="cbOP2RevisionArt[]" multiple="multiple" data-placeholder="Mehrfachauswahl durch Ctrl/Strg + LMausClick ...">
<!-- <option><?= $oLanguage->getExpression('optherapy', 'revisionArtChoice', 'revision surgery - please choose') ?></option> !-->
<option value="1" <?= $optherapie->getOP2RevisionArt() == '1' ? 'selected' : '' ?>><?= $oLanguage->getExpression('optherapy', 'revisionArt1', 'Devolvement laparoscopically') ?></option>
<option value="2" <?= $optherapie->getOP2RevisionArt() == '2' ? 'selected' : '' ?>><?= $oLanguage->getExpression('optherapy', 'revisionArt2', 'Devolvement openly') ?></option>
<option value="3" <?= $optherapie->getOP2RevisionArt() == '3' ? 'selected' : '' ?>><?= $oLanguage->getExpression('optherapy', 'revisionArt3', 'Dilatation') ?></option>
<option value="4" <?= $optherapie->getOP2RevisionArt() == '4' ? 'selected' : '' ?>><?= $oLanguage->getExpression('optherapy', 'revisionArt4', 'Band Explantation') ?></option>
[...]
<option value="20" <?= $optherapie->getOP2RevisionArt() == '20' ? 'selected' : '' ?>><?= $oLanguage->getExpression('optherapy', 'revisionArt20', 'Stent Implantation') ?></option>
</select>
</td>
</tr>
</table>
</div>
此代码执行其应做的工作:选择e。 G。前两个选项分别以“ 1、2”的形式写入数据库。
读取数据库值的对象类在 PHP5_classOPTherapie.php 中是这样的:
[...]
$qBaseline = 'SELECT ' .
' timestamp, ' .
' Datum, ' .
' DurchfuehrungVerantwortung, ' .
' OPTherapie, ' .
[...]
' OP2RevisionIndikation, ' .
' OP2RevisionArt, ' .
[...]
' FROM dat_optherapie ' .
" WHERE patID = $this->iPatientID " .
" AND revision = $rev; ";
$rResult = $oDatabase->query($qBaseline);
if ($oDatabase->getNumRows($rResult) == 0) {
echo '<p class="error">Es sind keine noch Daten vorhanden!</p><br />';
} else {
$aBaselineData = $oDatabase->getArrayAssoc($rResult);
[...]
//$haveOP2RevisionIndikation = explode(', ', $aBaselineData['OP2RevisionIndikation']);
//$this->setOP2RevisionIndikation($haveOP2RevisionIndikation);
//$haveOP2RevisionArt = explode(', ', $aBaselineData['OP2RevisionArt']);
//$this->setOP2RevisionArt($haveOP2RevisionArt);
$this->setOP2RevisionIndikation($aBaselineData['OP2RevisionIndikation']));
$this->setOP2RevisionArt($aBaselineData['OP2RevisionArt']);
用于保存数据库值的对象类在 PHP5_classOPTherapie.php 中如下所示:
[...]
$OP2RevisionIndikation = $this->getOP2RevisionIndikation();
$OP2RevisionArt = $this->getOP2RevisionArt();
[...]
$qInsertBase = 'INSERT INTO dat_optherapie (' .
' patID, ' .
' sessionID, ' .
' timestamp, ' .
' userID, ' .
' Datum, ' .
' DurchfuehrungVerantwortung, ' .
' revision, ' .
' OPTherapie, ' .
[...]
' OP2RevisionIndikation, ' .
' OP2RevisionArt, ' .
[...]
'VALUES (' .
" '$iPatientID', " .
" '$sessionID', " .
" now(), " .
" '$iUserID', " .
" '$Datum', " .
" '$DurchfuehrungVerantwortung', ".
" '$rev', " .
" '$OPTherapie', " .
[...]
" '$OP2RevisionIndikation', " .
" '$OP2RevisionArt', " .
[...]
现在,如上所述,这样做的作用与将值“ 1、2”正确保存到数据库一样。
现在我的问题:
读取方法可以将单个数据库条目(例如“ 3”)显示为其原始形式“ Weight Regain”,但不能显示为“ 1、2”-不显示任何内容(因为我没有分解它们)
我必须在哪里爆炸它们,以便再次显示原始用户选择?
内爆是否可以使用','而不是e。 G。 “”(即没有逗号,只是一个空格)是读取和显示数据库条目的问题吗?