query($sql);
foreach($arr as $v)
{
$sql = "select * from qqdongtai where dtid='{$v[1]}'";
$arr2 = $db->query($sql);
foreach($arr2 as $m)
{
//取发动态的姓名
$sql = "select name from qqusers where uid='{$v[2]}'";
$name = $db->strquery($sql);
//若果是登录者评论则显示“我”
if($v[2]==$uid)
{
$name ="我";
}
//获取被评论者的姓名
$sql = "select name from qqusers where uid=(select uid from qqdongtai where dtid='{$v[1]}')";
$bpl = $db->strquery($sql);
echo "
{$name}评论{$bpl}的动态:{$m[2]}
{$v[3]}
发表评论时间:{$v[4]}
删除评论
";
}
}
?>
第二步:回复
1、回复刚刚的评论:
2、将回复内容写进数据库
hf-cl.PHP页面
查看qqhuifu表,是不是多了一行呢?
3、将回复内容读出:
query($sql);
foreach($arr as $a)
{
$sql = "select * from qqpinglun where cid='{$a[1]}'";
$arr2 = $db->query($sql);
foreach($arr2 as $n)
{
//取评论动态的姓名
$sql = "select name from qqusers where uid='{$a[2]}'";
$name = $db->strquery($sql);
//若果是登录者评论则显示“我”
if($a[2]==$uid)
{
$name ="我";
}
//获取被回复评论的姓名
$sql = "select name from qqusers where uid=(select uid from qqpinglun where cid='{$a[1]}')";
$bpl = $db->strquery($sql);
echo "
{$name}回复{$bpl}的评论:{$n[3]}
{$a[3]}
回复时间:{$a[4]}
删除回复
";
}
}
?>
回复内容已经显示了:
第三步:删除
1、删除动态:(含评论和回复)
scdt-cl.PHP
query($sql,0);
$sql2 = "delete from qqpinglun where dtid='{$code}'";
$db->query($sql2,0);
$sql3 = "delete from qqhuifu where cid=(select cid from qqpinglun where dtid='{$code}')";
$db->query($sql3,0);
header("location:main.PHP");
?>
2、删除评论:(含回复)
scpl-cl.PHP
query($sql2,0);
$sql3 = "delete from qqhuifu where cid='{$code}'";
$db->query($sql3,0);
header("location:main.PHP");
?>
query($sql);
// var_dump($arr);
foreach($arr as $v)
{
$sql = "select name from qqusers where uid='{$v[1]}'";
$name = $db->strquery($sql);
if($v[1]==$uid)
{
$name = "我";
}
echo "
{$name}发表动态:
{$v[2]}
发表动态时间:{$v[3]}
删除动态
";
}
?>
query($sql);
foreach($arr as $v)
{
$sql = "select * from qqdongtai where dtid='{$v[1]}'";
$arr2 = $db->query($sql);
foreach($arr2 as $m)
{
//取发动态的姓名
$sql = "select name from qqusers where uid='{$v[2]}'";
$name = $db->strquery($sql);
//若果是登录者评论则显示“我”
if($v[2]==$uid)
{
$name ="我";
}
//获取被评论者的姓名
$sql = "select name from qqusers where uid=(select uid from qqdongtai where dtid='{$v[1]}')";
$bpl = $db->strquery($sql);
echo "
{$name}评论{$bpl}的动态:{$m[2]}
{$v[3]}
发表评论时间:{$v[4]}
删除评论
";
}
}
?>
query($sql);
// var_dump($arr);
foreach($arr as $a)
{
$sql = "select * from qqpinglun where cid='{$a[1]}'";
$arr2 = $db->query($sql);
// var_dump($arr2);
foreach($arr2 as $n)
{
//取评论动态的姓名
$sql = "select name from qqusers where uid='{$a[2]}'";
$name = $db->strquery($sql);
//若果是登录者评论则显示“我”
if($a[2]==$uid)
{
$name ="我";
}
//获取被回复评论的姓名
$sql = "select name from qqusers where uid=(select uid from qqpinglun where cid='{$a[1]}')";
$bpl = $db->strquery($sql);
echo "