Back to index

php5  5.3.10
sqlite.php
Go to the documentation of this file.
00001 <?php
00002 if (!extension_loaded("sqlite")) {
00003        dl("sqlite.so");
00004        if (!extension_loaded("sqlite")) {
00005               exit("Please enable SQLite support\n");
00006        }
00007 }
00008 
00009 debug_zval_dump(sqlite_libversion());
00010 debug_zval_dump(sqlite_libencoding());
00011 
00012 $s = sqlite_open("weztest.sqlite", 0666, $err);
00013 
00014 debug_zval_dump($err);
00015 debug_zval_dump($s);
00016 
00017 $r = sqlite_query("create table foo (a INTEGER PRIMARY KEY, b INTEGER )", $s);
00018 debug_zval_dump(sqlite_last_error($s));
00019 debug_zval_dump(sqlite_error_string(sqlite_last_error($s)));
00020 
00021 $r = sqlite_query("select *, php('md5', sql) as o from sqlite_master", $s);
00022 debug_zval_dump($r);
00023 debug_zval_dump(sqlite_num_rows($r));
00024 debug_zval_dump(sqlite_num_fields($r));
00025 
00026 for ($j = 0; $j < sqlite_num_fields($r); $j++) {
00027        echo "Field $j is " . sqlite_field_name($r, $j) . "\n";
00028 }
00029 
00030 while ($row = sqlite_fetch_array($r, SQLITE_ASSOC)) {
00031        print_r($row);
00032 }
00033 
00034 sqlite_close($s);
00035 
00036 ?>