lundi 29 août 2016

Updating MySQL table with PHP and checkboxes in WordPress

On my website enter link description here I'm using checkbox buttons for updating data in a MySql table (pages are with login) and use this code in PHP that's working fine:

<?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>&nbsp;</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>

But when I use the same code in WordPress (I'm trying to make the website in WordPress), it is not working and I get no records. When I put this code: echo $count. "<br />"; I get the right number of records in that table, only the records are not showed?

Any idea how to handle the problem? Thanks.

PS. I use the plugin phpexec in WordPress!




Aucun commentaire:

Enregistrer un commentaire