PHP SQLite JSON Data Duplication

前端 未结 2 1882
伪装坚强ぢ
伪装坚强ぢ 2021-01-22 01:40

I have the following PHP code:

$testMessage = \"TESTMESSAGE\";

$db = new SQLite3(\'messages.sq3\');
$db->exec(\'CREATE TABLE messages(id INTEGER PRIMARY KEY,         


        
2条回答
  •  自闭症患者
    2021-01-22 01:56

    The default is to have the data with both numeric and string keys, merged in the same array.

    You need to use $results->fetchArray(SQLITE3_NUM) or $results->fetchArray(SQLITE3_ASSOC) to get numeric and string keys respectively. The default is SQLITE3_BOTH, which I've always hated.

提交回复
热议问题