如:$dsql->ExecuteNoneQuery("Update `#@__archives` set `arcrank`='0', `sortrank`='$time', `pubdate`='$time' where id = '$id';");想在上面的语句中,加一条:Update `#@__taglist` set arcrank='0' ,请问如何加? 

解决方案 »

  1.   

    $dsql->ExecuteNoneQuery("Update `#@__archives`,`#@__taglist` set `#@__archives`.`arcrank`='0', `#@__archives`.`sortrank`='$time', `#@__archives`.`pubdate`='$time' ,`#@__taglist`.arcrank='0' where `#@__archives`.id = '$id';");
      

  2.   

    当您的问题得到解答后请及时结贴.
    http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
    http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
    http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html8、如何给分和结贴?
    http://community.csdn.net/Help/HelpCenter.htm#结帖
      

  3.   

    十分感谢ACMAIN_CHM ,你的速度和效率真的让我很佩服和感激,谢谢您!。同时感觉这里的气氛真的很好,我用你的代码测试了一下,已经成功,但是是所有的taglist表的所有arcrank的都更新为0了,我想按archives表随机所更新的id进行更新。下面我把整个代码贴出,还望给予帮助。require_once (dirname(__FILE__) . "/include/common.inc.php");
    require_once DEDEINC."/arc.archives.class.php";
    $row = $dsql->GetOne("Select uptime From `#@__arccache` where md5hash = 'autonew';");
    if(!is_array($row)) exit(autonew(5));
    if(time() - $row['uptime'] < $cfg_index_cache ) exit();autonew($no,$typeid,$order);
    //修改此处,可以设置每次自动审核的数量,$no为数字,$typeid为栏目ID,$order为排序方式function autonew($no='',$typeid='',$order=''){
    //函数参数:$no为数字,$typeid为栏目ID,$order为排序方式
    global $dsql,$cfg_index_cache;
    $no = is_numeric($no) ? intval($no) : 5;
    $order = (!$order == 'desc' && !$order == 'asc') ? ' order by rand() ' : " order by id $order ";
    $type = (is_numeric($typeid)) ? " and typeid = $typeid " : '';
    $sql = "SELECT id FROM `#@__archives` where arcrank ='-1' $type $order limit $no ;";
    $dsql->SetQuery($sql);
    $dsql->Execute();
    while($row = $dsql->GetArray()){
    $id = $row['id'];
    $time = time() - rand(0,$cfg_index_cache * 10);
    $dsql->ExecuteNoneQuery("Update `#@__arctiny` set `arcrank`='0', `sortrank`='$time' where id = '$id';");
    $dsql->ExecuteNoneQuery("Update `#@__archives` set `arcrank`='0', `sortrank`='$time', `pubdate`='$time' where id = '$id';");
    $ac = new Archives($id);
    $rurl = $ac->MakeHtml();
    } $dsql->ExecuteNoneQuery("Delete from `#@__arccache`;");
    $dsql->ExecuteNoneQuery("INSERT INTO `#@__arccache`(md5hash,uptime)values('autonew',".time().");");
    }
    ?>
      

  4.   

     (不要高估你的汉语表达能力或者我的汉语理解能力)
       建议你列出你的表结构,并提供测试数据以及基于这些测试数据的所对应正确结果。
       参考一下这个贴子的提问方式http://topic.csdn.net/u/20091130/20/8343ee6a-417c-4c2d-9415-fa46604a00cf.html
       
       1. 你的 create table xxx .. 语句
       2. 你的 insert into xxx ... 语句
       3. 结果是什么样,(并给以简单的算法描述)
       4. 你用的数据库名称和版本(经常有人在MS SQL server版问 MySQL)
       
       这样想帮你的人可以直接搭建和你相同的环境,并在给出方案前进行测试,避免文字描述理解上的误差。   
      

  5.   

    你可以把2条语句放到一起执行,比如
    exec("update table1 set a=100;update table2 set b=200;");