<?php
error_reporting(E_ALL ^ E_NOTICE);
session_start();
include 'dbFunctions.php';
if (isset($_POST['delete_designer'])) {
$id = $_GET['id'];
$query1 = "DELETE FROM designers WHERE id = '$id'";
$result1 = mysqli_query($link, $query1) or die(mysqli_error($link));
}else{
echo "No records added to the database.";
}
$query = "SELECT * FROM designers ORDER BY id";
$result = mysqli_query($link, $query) or die(mysqli_error($link));
mysqli_close($link);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="stylesheet/jquery-ui-1.8.16.custom.css">
<link rel="stylesheet" href="stylesheet/table_striping.css">
<script src="script/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="script/jquery.rating.js"></script>
<script>
$(document). ready(function(){
$("#theList tr:even").addClass("stripe1");x
$("#theList tr:odd").addClass("stripe2");
$("#theList tr").hover(
function() {
$(this).toggleClass("highlight");
} <script>
$(document). ready(function(){
);
});
</script>
<title>DESIGNERS</title>
</head>
<body>
<center><h1>LIST OF DESIGNERS</h1></center>
<hr/>
<center><p><a href="index.php">Home</a> | <a href ="search.php">Search Designers</a> | <a href ="View.php">View Designers</a> | <a href ="Add.php">Add New Designer</a></p></center>
<hr/>
<form method="post" action="index.php">
<table id="theList" align="center" width="500px">
<tr>
<th>S/N</th>
<th>Name</th>
<th>Contact Number</th>
<th>Email Address</th>
<th>Website</th>
<th>Position</th>
<th>Edit</th>
<th>Delete</th>
<?php
while ($row = mysqli_fetch_array($result)) {
$id = $row['id'];
$name = $row['name'];
$contact = $row['contact'];
$email = $row['email'];
$website = $row['website'];
$position = $row['position'];
echo "<tr>";
echo "<td>";
echo $id;
echo "</td>";
echo "<td>";
echo $name;
echo "</td>";
echo "<td>";
echo $contact;
echo "</td>";
echo "<td>";
echo $email;
echo "</td>";
echo "<td>";
echo $website;
echo "</td>";
echo "<td>";
echo $position;
echo "</td>";
?>
<td><a href="Edit.php?id=<?php echo $id; ?>"> <input type='button' id='<?php echo $id; ?>' value='Edit' onclick='hello(event);'></a></td>
<td><button value="Delete" type="delete" name="delete_designer" id='<?php echo $id; ?>'>Delete</button></td>
<?php
}
?>
</table>
</form>
</body>
</html>
Copyright © 2024 Q2A.ES - All rights reserved.
Answers & Comments
Looks like you're using $sql (which is never defined), instead of $logged at if (!mysql_query($sql, $con))
You use POST method, then try to $_GET... (id)
More errors than that one, though...