What problem are you trying to solve? Are you trying to figure out which ID you will need to use when inserting a record? In later versions (you probably want 2.3.4 or greater), SQLite will insert the ID for you if you try to insert a NUL value. If you need to find out what ID was inserted, just call the new (as of 2.2.3) sqlite_last_insert_rowid() function.
Also, you have a security hole in that code. Please read up about SQL injection attacks. You can fix the security hole using placeholders.
$sth = $dbh->prepare( "select CODE from INV where CODE = ?"); # Execute the SQL statement and generate a result set $sth->execute($user_input);
Cheers,
Ovid
New address of my CGI Course.
In reply to Re: Finding the next avaliable id in a SQLite database
by Ovid
in thread Finding the next avaliable id in a SQLite database
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |