어디서나 검색했지만 답변을 찾을 수 없지만 올바른 코드가 있다고 생각되지만 오타가있을 수 있습니다.PHP MySQL 행 삭제
여기에 무슨 문제가 있습니까?
나는 링크가 그 게시물과 같이 URL에 올바르게 제품 ID :
userAccount.php
:
while($columnDelete = mysqli_fetch_array($query, MYSQLI_ASSOC)){
echo "<section class='product'>
<a href='extras/deleteProcess.php?productId=".$columnDelete['productId']."' class='deleteProduct' style='color:#990000;font-family:arial;font-weight:bold;font-size:12pt;background:transparent;'>Delete?</a>
<section class='productImg'>
<a target='_self' href='fullProductInfo.php?productId=".$columnDelete['productId']."'>
<img src='http://www.littlepenguindesigns.co.uk/pages/CMX/images/products/".$columnDelete['productImg']."' alt='".$columnDelete['productName']."' border='0' width='230' height='200' border='0' />
</a>
</section>
<section class='productName'><a target='_self' href='fullProductInfo.php?productId=".$columnDelete['productId']."'>".$columnDelete['productName']."</a></section>
<section class='productPrice'>£".$columnDelete['price']."</section></section>";
}
$columnDelete['productId'];
가 URL에 올바른 ID를 게시하고, 내가 수있는 deleteProcess.php
페이지
deleteProcess.php
:
productId
을보고 나는 또한 확인하기 위해 페이지에 그것을 에코있다
$productId = $_GET['productId'];
$con = mysqli_connect("BLAH","BLAH","BLAH","BLAH") or die('Server connection not possible.');
$sql = ("DELETE FROM `product` WHERE `product`.`productId`= $productId");
mysqli_query($con, $sql);
echo "Deleted product ID: $productId successfully.<br /><br /><br /><br /><br /><br /> <a href='../userAccount.php#deletion'>Go back to user account and delete another.</a>";
나는 무슨 일이 벌어지고 있는지, 제품이 deleteProcess.php
으로 호출되어 페이지로 옮겨 지지만 삭제되지는 않지만 오류가 없음을 보여줍니다. 내가 php와 mysql에 익숙해 졌을 때 나는 최고의 연구를 할 것이라고 생각했다. 나는 물어볼 생각이 없었기 때문에 누구나 내가 잘못하고있는 것을 나에게 가르쳐 줄 수있다.
체크하면 –
쿼리를 에코 다음 phpMyAdmin을 직접 실행 한 후 오류가 원하든 참조 –