2016-04-12 4 views
0

SQLite3 :: openを使用してすべての行を選択するにはどうすればよいですか?次のコードは、1行だけを出力します。SQLite3 :: PHPを使ってすべての行を選択して開く?

<?php 

    /** 
    * Simple example of extending the SQLite3 class and changing the __construct 
    * parameters, then using the open method to initialize the DB. 
    */ 

    class MyDB extends SQLite3 
    { 
     function __construct() 
     { 
      $this->open('db_backups/database_123456789.db'); 
     } 
    } 

    $db = new MyDB(); 

    $result = $db->query('SELECT * FROM myBookmarks'); 
    var_dump($result->fetchArray()); 
    // ONLY DUMPS ONE RESULT 
    ?> 

ここに私のスタートコードがあります。その答えが見つかり http://www.php.net/manual/en/sqlite3.open.php

+0

これは通常、すべてのデシベルの結果ハンドラのケースです。 http://php.net/manual/en/function.sqlite-array-query.php – Anthony

+0

また、クエリは 'open'メソッドから実行されません。これは 'query'メソッドから実行されます。あなたが理解していないコードを実装しようとする前に、すべてのドキュメントを読んで理解を深める必要があるかもしれません。 – Anthony

+0

このコードを試してみるとエラーになります。致命的なエラー:未定義の関数sqlite_open()を呼び出す –

答えて

関連する問題