php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24538 sqlite_fetch_array
Submitted: 2003-07-08 08:05 UTC Modified: 2003-10-18 22:09 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: john at ceressoft dot nl Assigned:
Status: Closed Package: SQLite related
PHP Version: 5CVS-2003-07-08 (dev) OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: john at ceressoft dot nl
New email:
PHP Version: OS:

 

 [2003-07-08 08:05 UTC] john at ceressoft dot nl
Description:
------------
when fetching data with sqlite_fetch_array as an assioative array, the data and names mixes wrong up.

Output from print_r:

{0] =>
    [time] => 1057663053
    [app] => OLAF
    [user] => Pakhuis administratie
    [msg] => login, new session

As you can see, columns app and user are exchanged


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-08 08:16 UTC] wez@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


How about a complete self-contained reproducing script? :)

 [2003-07-15 16:36 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-10-18 21:41 UTC] kevin at oceania dot net
Tested this bug with php5beta2 and the problem does not exist
any longer, if it did in the beginning. test script follows...

<?php
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#SQLite Admin Structure Dump for table testtable
#
CREATE TABLE testtable (fone VARCHAR(99) NOT NULL DEFAULT 'blah', ftwo VARCHAR(3) NOT NULL DEFAULT 'blahblah', fthree VARCHAR(99) NOT NULL DEFAULT '')
                                                                                                                          
#
### SQLite Admin Data Dump for table testtable
#
INSERT INTO testtable ( one, two, three);
INSERT INTO testtable ( one2, two2, three3);
INSERT INTO testtable ( one3, two3, three3);
INSERT INTO testtable ( one4, two4, three4);
INSERT INTO testtable ( one5, two5, three5);
                                                                                                                          
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
                                                                                                                          
  // make sure it is broken
  error_reporting(E_ALL);
  // our sql
  $sql = "SELECT * FROM testtable";
  // connect to the db
  $db = @sqlite_open('test.db', 0666, $sqliteerror);
  // run the query
  $res=sqlite_query($db, $sql);
  // set a counter
  $i=0;
  // begin table for layout
  echo '<table border="1"><tr>';
  // get the field names
  while($i<sqlite_num_fields($res))
        {
        // echo the field names
        echo '<th>'.sqlite_field_name($res, $i).'</th>';
        // increment the counter
        $i++;
        }
  // end the table header row
  echo '</tr>';
                                                                                                                          
  // loop through the ASSOCIATIVE array
  while($row=sqlite_fetch_array($res, SQLITE_ASSOC))
        {
        // echo out the values
        echo '<tr><td>'.$row['fone']. '</td><td>'.$row['ftwo'].'</td><td>'.$row['fthree'].'</td></tr>';
        }
                                                                                                                          
  // end of table
  echo '</table>';
?>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 01:01:28 2024 UTC