【发布时间】:2016-08-30 02:53:36
【问题描述】:
在我的网站enter link description here 上,我使用复选框按钮来更新 MySql 表中的数据(页面带有登录名),并在 PHP 中使用此代码,它工作正常:
<?php
$sql="SELECT *,cast(DATE_FORMAT(datum,'%d-%m-%Y ') AS CHAR(32)) as datum FROM wedstrijden";
$result=mysqli_query($db,$sql);
$count=mysqli_num_rows($result);
?>
<table style="width: 100%;">
<tr>
<td><form name="frmactive" action="1fanionchange.php" method="post">
<tr>
<td colspan="6"><input name="activate" type="submit" id="activate" value="Open selected" />
</tr>
<tr>
<td> </td>
</tr><tr>
<td align="center"><!--<input type="checkbox" name="allbox" title="Select or Deselct ALL" style="background-color:#ccc;"/> --></td>
<td align="center"><strong>Id</strong></td>
<td align="center"><strong>Datum</strong></td>
<td align="center"><strong>Uur</strong></td>
<td align="center"><strong>Thuis</strong></td>
<td align="center"><strong>Uit</strong></td>
</tr>
<?php
while($rows=mysqli_fetch_array($result)){
?>
<tr>
<td align="center"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td>
<td align="center"><? echo $rows['id']; ?></td>
<td align="center"><? echo $rows['datum']; ?></td>
<td align="center"><? echo $rows['uur']; ?></td>
<td align="center"><? echo zoeknaam($rows['thuisploeg']); ?></td>
<td align="center"><? echo zoeknaam($rows['uitploeg']); ?></td>
</tr>
<?php
}
?>
<tr>
<td colspan="6"><input name="activate" type="submit" id="activate" value="Open selected" />
</tr>
</form>
</td>
</tr>
</table>
但是当我在 WordPress 中使用相同的代码时(我正在尝试在 WordPress 中制作网站),它无法正常工作并且没有显示任何记录。当我尝试使用以下方法查找行数时:
echo $count. "<br />";
我在该表中获得了正确数量的记录。但是记录没有显示?
知道如何处理这个问题吗?谢谢。
PS。我在WordPress中使用插件phpexec!
【问题讨论】:
-
您的服务器是否启用了 php 短标签?你正在混合
<?php和<?(就像你在哪里回显复选框值)。
标签: php mysql wordpress checkbox