|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-04-17 12:27 UTC] derick@php.net
[2005-04-17 22:57 UTC] bart at mediawave dot nl
[2005-04-18 08:41 UTC] derick@php.net
[2005-04-18 14:02 UTC] wez@php.net
[2005-04-18 16:05 UTC] bart at mediawave dot nl
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 09:00:01 2025 UTC |
Description: ------------ With the SQLite functions: The problem occurs when selecting fields in a tablename.fieldname manner. Example: SELECT test.myfield, test.otherfield FROM test The result array will have ['tablename.fieldname'] as index. This should be just ['fieldname'] as index. Reproduce code: --------------- <?php $dbfile = 'db/test2db.db'; if (!file_exists($dbfile)) { $setup = " CREATE TABLE test (myfield varchar(50), otherfield varchar(50)); INSERT INTO test (myfield, otherfield) VALUES ('value1', 'value1'); INSERT INTO test (myfield, otherfield) VALUES ('value2', 'value2'); "; } $connectionId = sqlite_open($dbfile, 0666, $sqliteerror); if ($setup) sqlite_exec($connectionId, $setup); $sql = 'SELECT test.myfield, test.otherfield FROM test'; $resultId = sqlite_query($connectionId, $sql); while ($result = sqlite_fetch_array($resultId, SQLITE_ASSOC)) print_r($result); ?> Expected result: ---------------- Array ( [myfield] => value1 [otherfield] => value1 ) Array ( [myfield] => value2 [otherfield] => value2 ) Actual result: -------------- Array ( [test.myfield] => value1 [test.otherfield] => value1 ) Array ( [test.myfield] => value2 [test.otherfield] => value2 )