我有一个表,其中有一个名为 link_id 的 A_I 列。当我这样跑时:
$link_id = 32;
$query1 = "DELETE FROM links WHERE link_id = $link_id";
if(!mysql_query($query1,$connection));
{
die(mysql_error($connection));
}
它可以成功运行,但是当我使用 C# WebRequest 尝试此操作时:
WebRequest request = WebRequest.Create("http://www.mywebsite.com/deleteLink.php");
request.Method = "POST";
string post = "link_id=" + id //type string;
byte[] postBytes = Encoding.UTF8.GetBytes(post);
request.ContentLength = postBytes.Length;
request.ContentType = "application/x-www-form-urlencoded";
Stream dataStream = await request.GetRequestStreamAsync();
dataStream.Write(postBytes, 0, postBytes.Length);
WebResponse response = await request.GetResponseAsync();
return new StreamReader(response.GetResponseStream()).ReadToEnd();
返回:“where 子句”中的未知列“32”
我在哪里做错了?谢谢。