when i go to produkdelete.php i can
view the record that i want to delete, but when i confirm to delete there is no deleted
record
this is my script
:
$key =
@$_GET["key"];
case "I": // Get a record to
display
$tkey = $key;
$strsql = "SELECT *
FROM `produk` WHERE `id`=".$tkey;
$rs = mysql_query($strsql,
$conn) or die(mysql_error());
if (mysql_num_rows($rs) ==
0)
{
ob_end_clean();
header("Location:
"."produklist.php");
}
$row =
mysql_fetch_assoc($rs);
$x_id = $row["id"];
$x_kdprod =
$row["kdprod"];
$x_namaprod = $row["namaprod"];
$x_diskripsi =
$row["diskripsi"];
$x_harga = $row["harga"];
mysql_free_result($rs);
break;
case "D": //
Delete
// Open record
$tkey = $key;
$strsql
= "DELETE FROM `produk` WHERE `id`=".$tkey;
$rs =
mysql_query($strsql, $conn) or die(mysql_error());
mysql_free_result($rs);
mysql_close($conn);
ob_end_clean();
header("Location: produklist.php");
break;
the key
variable is send from
"produkdelete.php?key=".urlencode($row["id"]);
and
everytime i run this the output just come like this :
You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version for the right
syntax to use near '=' at line 1
No comments:
Post a Comment