国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

workman里封裝的數(shù)據(jù)庫方法,where 可以直接用in方法嗎

xamarin

workman里封裝的數(shù)據(jù)庫方法,where 可以直接用in方法嗎。我用了,它報錯。Parse error: syntax error, unexpected 'restart' (T_STRING) in /pi/components/com_work/GatewayWorker/Lib/Gateway.php on line 134
有誰具體用過。具體代碼

public static function getInsertUsers($user,$count){//返回需要增加的用戶列表
        $redis = new \Redis();
        $redis->connect('127.0.0.1', 6379);
        $key = 'maxcont:' .$user;
        $c= $redis ->llen($key)-$count; 
        $rr= $redis -> lRange($key, 0, (int)($c));php /pi/components/com_work/start.php restart 
        $r= implode(',', $rr);
        $db1 = Db::instance('db1'); 
        if( !empty($r) ){    
             return     $db1->select('userid,alias,thumb,latitude,longitude')->from('q_community_users')->where('userid in $r')->query();

        } 
    }
4010 5 0
5個回答

xamarin

exception 'PDOException' with message 'SQLSTATE: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$r' at line 1' in /pi/components/com_work/GatewayWorker/Lib/DbConnection.php:1751

  • 暫無評論
damao

Parse error: syntax error, unexpected 'restart' (T_STRING)

是PHP語法錯誤啊,自己的問題啊,和workerman數(shù)據(jù)庫類沒毛關(guān)系。

check the manual that corresponds to your MySQL server version for the right syntax to use near '$r'

第二個sql語法錯誤啊,又是你自己的問題啊
where('userid in $r')
改成
where("userid in ($r)")
試下。php變量放到雙引號里才能解析啊,而且你好像還少了個括號。

  • 暫無評論
xamarin

上面的說法很中肯,也很真實,我也改過來了。嘗試in的各種寫法,現(xiàn)在還是報錯

  • 暫無評論
xamarin
public static function getInsertUsers($user,$count){//返回需要增加的用戶列表
        $redis = new \Redis();
        $redis->connect('127.0.0.1', 6379);
        $key = 'maxcont:' .$user;
        $c= $redis ->llen($key)-$count; 
        $rr= $redis -> lRange($key, 0, (int)($c));
        $r= implode(',', $rr);
        $db1 = Db::instance('db1'); 
        if( !empty($r) ){    

            return  $db1->select('userid,alias,thumb,latitude,longitude')->from('q_community_users')->where("userid in( '$r')")->query();//where("userid in ($r)")

        } 
    }

報錯信息exception 'PDOException' with message 'SQLSTATE: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'in( '422,421,421,420,419,418,417,416,415')' at line 1' in /pi/components/com_work/GatewayWorker/Lib/DbConnection.php:1751 Stack trace:

  • 暫無評論
xamarin

終于不報錯了

 public static function getInsertUsers($user,$count){//返回需要增加的用戶列表
        $redis = new \Redis();
        $redis->connect('127.0.0.1', 6379);
        $key = 'maxcont:' .$user;
        $c= $redis ->llen($key)-$count; 
        $rr= $redis -> lRange($key, 0, (int)($c));
        $db1 = Db::instance('db1'); 
        if( !empty($rr) ){    
            return  $db1->select('userid,alias,thumb,latitude,longitude')->from('q_community_users')->where(" userid in (" . implode(',',$rr) . ")")->query();              
        } 
    }
  • 暫無評論
年代過于久遠,無法發(fā)表回答
??