I have a table in which are presented dates from different tables using INNER JOIN
.
I want to add a field where you can delete one row. I tried several tutorials but something is wrong with my code. Every time I try to delete a row it says:
Access denied for user(using password: NO)
However, my connection config is ok.
$query="SELECT products.id, products.product_name, products.product_description,
products.product_price, collections.collection_name, collections.collection_season,
collections.collection_year
FROM products
INNER JOIN products_collections ON products.id = products_collections.product_id
INNER JOIN collections ON collections.id = products_collections.collection_id
ORDER BY products.product_price";
$result=mysqli_query($con,$query);
while ($row=mysqli_fetch_array($result)){
echo "<tr><td>".$row["id"]."</td><td>".$row["product_name"]."</td>
<td>".$row["product_description"].
"</td><td>".$row["collection_name"]."</td><td>".$row["collection_season"]."</td>
<td>".$row["collection_year"]."</td><td>".$row["product_price"].
" USD</td><td><a href='table.php?del=$row[id]'>Delete</a></td></tr>";
}
if (isset($_GET['del'])){
$id=$_GET['del'];
$s="DELETE FROM products WHERE id='$id'";
$res=mysql_query($s) or die ("Failed ".mysql_error());
echo "<meta http-equiv='refresh' content='0;url=table.php'>";
}
?>