CHAPTER 6 – SQLite – Other Result Set-Related Functions
You can use a few other func- t i o n s a n d m e t h o d s o n r e s u l t s e t s . T h e m e t h o d n u m F i e l d s ( ) (sqlite_num_fields()) returns the number of fields in the result set, and the method fieldName() (sqlite_field_name()) returns the name of the field. The only parameter to this method is the index of the field into the resultset (zero- based). If you do make a join between multiple tables, notice that this function returns the name of the field "as-is" from the query; for example, if the query contains "SELECT a.field1 FROM address a", the name of the field that is returned will be "a.field1".
Another peculiarity with column names, which is also valid for keys in returned arrays with the SQLITE_ASSOC option set, is that they are always returned in the same case as they were created in the "CREATE TABLE" state- ment. By setting the sqlite.assoc_case option in php.ini to 1, you force the SQLite extension to return uppercase column names. By setting it to 2, you force the extension to return lowercase column names. A setting of 0 (the default) does not touch the case of column names at all. The numRows() method (sqlite_num_rows()) returns the number of records in the result set, but only works for buffered queries.