ted_chou12 Posted February 19, 2011 Share Posted February 19, 2011 Hi, I found all the functions for create table, insert..etc. but I could find a function that returns all the table? http://www.php.net/manual/en/function.sqlite-open.php Like there would be tables that the script does not know, and it would be fetched like a wildcard? <?php $db_path = "/var/db/blog.db"; $dbh = sqlite_open($db_path); $query....? ?> Thanks Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 20, 2011 Share Posted February 20, 2011 It appears you need to run a query to return that information: http://www.sqlite.org/faq.html#q7 Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted February 20, 2011 Author Share Posted February 20, 2011 thanks, it should be like this: [code]$dbh = sqlite_open($db_path); $query = sqlite_query($dbh, "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"); $result = sqlite_fetch_all($query, SQLITE_ASSOC); foreach ($result as $entry) { echo 'Name: ' . $entry['name']; echo "<br />"; } [/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.