MD,郁闷死了,谁来帮我看看!!!

daeren 2004-07-09 11:38:27
<?
require "functions.php";
?>

<?
$id = intval($id);
$sql = "select id,show_on_index from images where id=$id";
$result = mysql_query($sql) or die(mysql_errno().": ".mysql_error()."\n");
if(!$rs=mysql_fetch_assoc($result))
{
echo "此记录可能已经被删除!";
}
if($rs["show_on_index"]=0)
{

$DB->query('update images set show_on_index="1" where id=$id');
header("location:images.php");

}
else
{

$DB->query('update images set show_on_index="0" where id=$id');
header("location:images.php");

}

?>

为什么无法更新!!!
...全文
80 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
daeren 2004-07-09
  • 打赏
  • 举报
回复
真他的超级郁闷!!!
自己解决了
上面的是一个问题!
yazikkk 2004-07-09
  • 打赏
  • 举报
回复
if($rs["show_on_index"]==0)
daeren 2004-07-09
  • 打赏
  • 举报
回复
数据连接是没有问题的!!!
daeren 2004-07-09
  • 打赏
  • 举报
回复
我知道那句意义不大
但是我不知道怎么来set rs
不好意思,刚刚接触php!!!
daeren 2004-07-09
  • 打赏
  • 举报
回复
当然有id的column
show_on_index="0"改成show_on_index=0是一样的!!!
zairwolf 2004-07-09
  • 打赏
  • 举报
回复
if(!$rs=mysql_fetch_assoc($result))
{
echo "此记录可能已经被删除!";
}

这句有意义么?可以在前面直接加!么?
raid79 2004-07-09
  • 打赏
  • 举报
回复
把show_on_index="0"改成show_on_index=0试试看
szjq 2004-07-09
  • 打赏
  • 举报
回复
你的表中有没有叫id这一列的
Unknown column '$id' in 'where clause'
daeren 2004-07-09
  • 打赏
  • 举报
回复
出现这样的情况
SQL 无效: update images set show_on_index="0" where id=$id
Mysql error description: Unknown column '$id' in 'where clause'



当我改为这样的时候!
$DB->query('update images set show_on_index="0" where id=$id');
更新无效!!!

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧