Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Plain Text by userrrr ( 13 years ago )
<html>
<head>
</head>
<body>
<a href="add.php"> add </a>
<form method="post" acti >
<?php
$con=mysql_connect("localhost","root","");
if (!$con)
{
echo "Failed to connect to MySQL: " . mysql_error();
}
mysql_select_db("dvk_db",$con);
$result=mysql_query("select manage_books.id,manage_books.book,authors.name,manage_books.price,manage_books.last_modified
from manage_books inner join authors on manage_books.author_id=authors.id");
echo "<table border=1>";
echo "<tr>
<th> </th>
<th> Book </th>
<th> Author </th>
<th> Price </th>
<th> Last modified </th>
<th> Action </th>
<tr>";
while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td><input type='checkbox' name='checkbox[]' id='checkbox[]' value='". $row['id'] . "'> </td>";
echo "<td>".$row['book']."</td>";
echo "<td>".$row['name']."</td>";
echo "<td>".$row['price']."</td>";
echo "<td>".$row['last_modified']."</td>";
echo "<td> <a id=".$row['id'].">edit </a></td>";
echo "<tr>";
}
echo "</table>";
?>
<input type="submit" name="delete" value="delete" id="delete" />
<?php
if ((isset($_POST['delete'])) && (!empty($_POST['checkbox'])))
{
foreach($_POST['checkbox'] as $did)
{
$query = "DELETE FROM manage_books WHERE id = $did";
$link = mysql_query($query);
}
if($link)
{
header("location:manage.php");
}
}
?>
</form>
</body>
</html>
Revise this Paste