删除语法与选择语法不同(您根本不选择列名或*
在其中使用 a ):
"DELETE FROM Ikea WHERE `CatalogNumber` = $thisCatalog";
应该做的伎俩。
以及我的测试数据库中的一些示例:
mysql> select * from first;
+------+-------+
| id | title |
+------+-------+
| 1 | aaaa |
| 2 | bbbb |
| 3 | cccc |
| 4 | NULL |
| 6 | gggg |
+------+-------+
5 rows in set (0.00 sec)
mysql> insert into first values (7, 'cccc');
Query OK, 1 row affected (0.01 sec)
mysql> select * from first;
+------+-------+
| id | title |
+------+-------+
| 1 | aaaa |
| 2 | bbbb |
| 3 | cccc |
| 4 | NULL |
| 6 | gggg |
| 7 | cccc |
+------+-------+
6 rows in set (0.00 sec)
mysql> delete from first where id=7;
Query OK, 1 row affected (0.01 sec)
mysql> select * from first;
+------+-------+
| id | title |
+------+-------+
| 1 | aaaa |
| 2 | bbbb |
| 3 | cccc |
| 4 | NULL |
| 6 | gggg |
+------+-------+
5 rows in set (0.00 sec)