我正在尝试编写要在MySQL中删除的行。
我不知道如何做到这一点所以从其他网站上选择了一些代码:
语法:
<?php
$personID=$_GET["q"];
if ($personID<="0"){echo( "<center><h3><a href=\"#\" onclick=\"window.close(); return false\">NO ID ERROR CLICK THIS TO RETRY CLOSE WINDOW</a></h3></center>");
}
else
{
$con = mysql_connect("mysql.XXX.com","XXX","XXX");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$myid=$_COOKIE["user"];
@mysql_select_db("u716720408_admin", $con)or die( "Unable to select database");
$result=mysql_query("DELETE * FROM users WHERE personID=$personID")or die(mysql_error());
$cnt=1;
$row = mysql_fetch_array( $result );
$f1=$row['personID'];
$f2=$row['personFname'];
$f9=$row['llmail'];
$f14=$row['personSname'];
$f19=$row['password'];
?>
答案 0 :(得分:5)
答案 1 :(得分:3)
删除查询中不需要*
试
DELETE FROM users WHERE personID=$personID
答案 2 :(得分:1)
在您的搜索结果中,您无需在删除查询
中提及*
$result = mysql_query("DELETE FROM users WHERE personID=$personID") or
die(mysql_error());