note 119892 added to sqlite3result.finalize
| From: | lukegamitchell at gmail dot com | Date: | Fri, 16 Sep 2016 03:16:38 +0000 |
| Subject: | note 119892 added to sqlite3result.finalize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-206597@lists.php.net to get a copy of this message | ||
A simple example using finalize().
// Open the database connection
$db = new SQLite3('database.db');
// Prepare a query for execution
$query = $db->prepare('SELECT user_id FROM users WHERE username=:username');
$query->bindValue(':username', $_COOKIE['username'], SQLITE3_TEXT);
// Execute the query
$result = $query->execute();
// Store the result of the query
$id = $result->fetchArray(SQLITE3_NUM)[0];
// Close the result set and database connection
$result->finalize();
$db->close();
Of course you should be more careful and clean your cookie, etc.
----
Server IP: 72.52.91.14
Probable Submitter: 216.113.205.249
----
Manual Page -- http://php.net/manual/en/sqlite3result.finalize.php
Edit -- https://master.php.net/note/edit/119892
Del: integrated -- https://master.php.net/note/delete/119892/integrated
Del: useless -- https://master.php.net/note/delete/119892/useless
Del: bad code -- https://master.php.net/note/delete/119892/bad+code
Del: spam -- https://master.php.net/note/delete/119892/spam
Del: non-english -- https://master.php.net/note/delete/119892/non-english
Del: in docs -- https://master.php.net/note/delete/119892/in+docs
Del: other reasons-- https://master.php.net/note/delete/119892
Reject -- https://master.php.net/note/reject/119892
Search -- https://master.php.net/manage/user-notes.php