[Record:IT][PHP][SQLite] Open SQLite3 in PHP

Open SQLite3 Database with PHP | 用PHP開啟SQLite3資料庫

(圖文不符)

For easy access, I always load the database to a standard object for process, record for easy copy-and-paste!
懶,Load晒成個Database去個StandardObject再做其他動作,記錄一下方便copy-and-paste!

$dbfile = "/path/to/filename";
$db = new SQLite3($dbfile);
$db_value[] = new stdClass();
$db_obj_court = 0;
$sql = "SELECT * FROM table_name WHERE condition";
$result = $db->query($sql);
while ($row = $result->fetchArray()) {
$db_value[$db_obj_court]->col_name = $row[col_name];
...
...
$db_obj_court += 1;
}

TN [20200914]

--

--

TN.HK
Messages From Irresponsible Fat Boy

Record and share something that are found interesting when roaming at the internet or real life!