Jump to content

Recommended Posts

Hi, I'm trying to create a page where we can remove bans from the MySQL database. I've come up with this so far, but need some help.

 

	
<form method="post" action="viewbans.php" name="managebans">
<table width="100%" border="1">
<tr>
<td>Remove?</td>
<td>IP</td>
<td>Username</td>
<td>Reason</td>
</tr>
<?php
mysql_connect("localhost", "islewar", "islewar") or die(mysql_error());
mysql_select_db("islewar") or die(mysql_error());

$result = mysql_query("select * from bans") or die(mysql_error());
while($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td><input type=checkbox name=ban />";
echo "</td>";
echo "<td>";
echo $row['ip'];
echo "</td><td>";
echo $row['username'];
echo "</td><td>";
echo $row['reason'];
echo "</td>";
echo "</tr>";
}
?>
</table>
<input type="submit" name="delete" value="Remove Bans" />
</form>

 

It reads the data from the database and shows it on the screen correctly. I just can't get the checkboxes to delete when they are selected,

 

Thanks :)

Link to comment
https://forums.phpfreaks.com/topic/238677-deleteing-mysql-rows-with-php/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.