-5

任何人都知道为什么在这两个 mySQL 请求中,第一个有效而第二个无效?

$bdd->exec('UPDATE users SET status = \'registered\' WHERE username="' . $userz . '"'); // working:)



$bdd->exec('DELETE ' . $_SESSION['prenom'] . 'friendlist WHERE name="' .  $_POST['deletefriend'] . '"'); // not working :(

没有显示错误,但数据库中的数据没有被删除。

4

1 回答 1

2

试试喜欢

$bdd->exec('DELETE FROM `' . $_SESSION['prenom'] . 'friendlist` WHERE name="' .  mysql_real_escape_string($_POST['deletefriend']) . '"'); 

或喜欢 它会工作

$bdd->exec("DELETE FROM ". $_SESSION['prenom'] . "friendlist WHERE friendname='".$_POST['deletefriend']."'");

Delete From table_name .... 将是它的语法

于 2013-05-20T04:42:50.437 回答