Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SQLite查询中循环的javascript_Javascript_Sqlite - Fatal编程技术网

SQLite查询中循环的javascript

SQLite查询中循环的javascript,javascript,sqlite,Javascript,Sqlite,我已经创建了一个函数,它将从我的数据库返回字符串“path” function getAudio(mid, cb) { //mid is an array containing the id to some multimedia files. for(i=0; i < mid.length; i++) { db.transaction(function(tx) { tx.executeSql('SELECT * FR

我已经创建了一个函数,它将从我的数据库返回字符串“path”

    function getAudio(mid, cb) {
    //mid is an array containing the id to some multimedia files.
    for(i=0; i < mid.length; i++) {

        db.transaction(function(tx) {
                tx.executeSql('SELECT * FROM Multimedia WHERE Mid=' + mid[i] + ' AND Type=' + 2, [], function(tx, results) {    
                //type=2 is audio. (type=1 is picture file etc) There is only one audiofile in the array.
                    if(results.rows.length > 0) {
                        path = results.rows.item(0).Path; 
                        cb(path);
                    }
                }, errorCB);
        }, errorCBQuery);

    }//end for
}//end getAudio()
函数getAudio(mid,cb){ //mid是一个数组,包含一些多媒体文件的id。 对于(i=0;i@YaqubAhmad:在我获得15分之前,我无法投票。但我在“有用的帖子”中回答了“是”)@TorK:不过,你可以接受答案(如果你觉得可以接受的话)@T.J.Crowder:aah这就是这个符号的意思^^再次感谢,我想我看到你们了;)嗨,克劳德,你能建议我如何解决我的问题吗,链接如下