当我尝试删除用户时显示此异常(错误)。
Error: the XML response that was returned from the server is invalid.
Received:
Cannot delete or update a parent row: a foreign key constraint fails
(`db_almacen`.`perfil_solicitud_material`, CONSTRAINT `perfil_solicitud_material_ibfk_1`
FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id_usuario`))
它以这种方式显示,因为我有一个与我的用户 ID 相关的外键。我想显示不同的消息而不是那个。我该怎么做我检查了php异常手册但我没有找到一个例子请帮助我。我正在使用 Mysql 和 PHP 我的 php 代码
$query = "DELETE FROM unidad_solicitante where id_unid_sol ='$cod';";
$result = mysql_query($query) or die(mysql_error());
谢谢你