内爆无效参数
function delete($rowid)
{
$rowids = implode(", ",$rowid);
$sql = "DELETE FROM pms WHERE id IN (".$rowids.")";
print $sql;
}
if (isset($_POST['submit']))
{
delete($rowid);
}
?>
<form method="post" action="test.php">
<input type="checkbox" name="rowid[]" value="1771367" /><br >
<input type="checkbox" name="rowid[]" value="345342" /><br >
<input type="checkbox" name="rowid[]" value="572347" /><br >
<input type="checkbox" name="rowid[]" value="902358" /><br >
<input type="checkbox" name="rowid[]" value="234654" /><br ><br >
<input type="submit" name="submit" />
</form>
警告:implode() [function.implode]:传入的参数无效 C:\pub\test.php 第 4 行 DELETE FROM pms WHERE id IN ()
我在这里做错了什么? 在这里要疯了..
function delete($rowid)
{
$rowids = implode(", ",$rowid);
$sql = "DELETE FROM pms WHERE id IN (".$rowids.")";
print $sql;
}
if (isset($_POST['submit']))
{
delete($rowid);
}
?>
<form method="post" action="test.php">
<input type="checkbox" name="rowid[]" value="1771367" /><br >
<input type="checkbox" name="rowid[]" value="345342" /><br >
<input type="checkbox" name="rowid[]" value="572347" /><br >
<input type="checkbox" name="rowid[]" value="902358" /><br >
<input type="checkbox" name="rowid[]" value="234654" /><br ><br >
<input type="submit" name="submit" />
</form>
Warning: implode() [function.implode]: Invalid arguments passed in
C:\pub\test.php on line 4 DELETE FROM pms WHERE id IN ()
What Am I doing wrong here? Going crazy over here..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您要从帖子中获取该内容,则需要使用
$_POST['rowid']
。另外:
清理你的 SQL!
You need to use
$_POST['rowid']
, if you're grabbing that from post.Also:
Sanitize your SQL!
您没有将正确的变量传递给您的函数。 你需要用
You're not passing the right variable to your function. You need to call it with
看起来你读过一些非常古老的 PHP 手册,其中
register_globals = on
,你需要阅读你的案例中的 POST 参数。looks like you read some really old PHP manual where
register_globals = on
, you need to read the POST parameters in your case..