PHP,DELETE不起作用

时间:2013-12-03 11:28:29

标签: php android mysql

android java文件。

List<NameValuePair> params = new ArrayList<NameValuePair>();
 params.add(new BasicNameValuePair("name", username));
 params.add(new BasicNameValuePair("channel", channel));
// getting details by making HTTP request
 JSONObject json = jParser.makeHttpRequest(
"localhost/users/url_delete_users.php", "POST", params);

url_delete_users.php

 if (isset($_POST['name']) && isset($_POST['channel'])) {
    $name = $_POST['name'];     $channel = $_POST['channel'];
     // include db connect class
     require_once __DIR__ . '/db_connect.php';
     // connecting to db
     $db = new DB_CONNECT();
     // mysql update row with matched pid
    $result = mysql_query("DELETE FROM users WHERE name = $name AND channel=$channel");**

mysql_query有什么问题吗? 它不起作用...... (create db php source运行良好。只有删除获取错误)

4 个答案:

答案 0 :(得分:1)

确保上面的一切正常,然后试试这个:

$result = mysql_query("DELETE FROM users WHERE name = '".$name."' AND channel='".$channel."'");

答案 1 :(得分:0)

你能试试吗,

  $result = mysql_query("DELETE FROM users WHERE 
              `name` = '".$name."' AND channel='".$channel."' ") 
              or die(mysql_error());

而不是

 $result = mysql_query("DELETE FROM users WHERE name = $name AND channel=$channel");

答案 2 :(得分:0)

试试这个

$result = mysql_query("DELETE FROM users WHERE name = '$name' AND channel='$channel'");

答案 3 :(得分:0)

我认为

$result = mysql_query("DELETE FROM users WHERE name = $name AND channel=$channel");

应该是

$result = mysql_query("DELETE FROM users WHERE name = '$name' AND channel='$channel'");