note 47442 deleted from ref.sqlite by cmb
| From: | cmb@php.net | Date: | Mon, 02 Nov 2020 14:57:01 +0000 |
| Subject: | note 47442 deleted from ref.sqlite by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215709@lists.php.net to get a copy of this message | ||
Note Submitter: nicolas dot toniazzi at free dot fr
----
The same in 3 lines.
<?php
function sqlite_table_exists($db,$mytable) {
/* counts the tables that match the name given */
$result = sqlite_query($db,"SELECT COUNT(*) FROM sqlite_master WHERE type='table'
AND name='$mytable'");
/* casts into integer */
$count = intval(sqlite_fetch_single($result));
/* returns true or false */
return $count > 0;
}
?>