php - Sqlite database does not return PRIMARY field value -


i have sqlite db. i'm using sqlite3 extension connect in php.

database program used until invoices. took out sqlite file program , wrote own web based inteface.

everything seems ok, except when created new table existing database.

database created, add new entries , lastinsertrowid() gave proper last insert ids.

however, when started select entries new table, ids (primary key) empty.

i opened database sqlite database browser , odd.

maybe first give db schema:

create table if not exists koszty (     id numeric primary key desc,     data numeric,     nazwa text,     wartosc_netto numeric unsigned,     podatek numeric unsigned,     typ numeric unsigned,     filename text,     opis text ) 

when opened db there strange table sqlite_autoindex_koszty_1 seems correspond table only. old tables not have it.

on other hand there sqlite_sequence table seems store autoincrement ids.

all tables have name here , ai value except koszty.

what reason? how fix db. me doing wrong (maybe sqlite versions different? using sqlite3 on sqlite2 db?) or sqlite inconsistent?

to make 1 of columns autoincrementing, must declare integer primary key (not numeric). if have no such column, value returned lastinsertrowid hidden rowid column.

the sqlite_autoindex_ object not table internal index created primary key.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -