Hello dear comrades!
I hope together we will be able to shed some light on a rather mysterious
occurrences which are plaguing me for the past few days;
I have an sqlite3 db that stores user-accounts (each user has an id); When a
new user wants to add his account to db, he sends
all his data fields as he wants them, but id is left as zero;
then a backend handles the request like this:
if ($php_data->id == 0) {
$query = "SELECT MAX(id) AS largestID FROM profiles";
$result_array = $database->arrayQuery($query, SQLITE_ASSOC);
foreach ($result_array[0] as $key => $value)
$max_id = $value;
$new_max_id = $max_id+1;
$query =
'INSERT INTO profiles (birthDate, company, country, email, facebook,
firstName, gender, id, lastName, skype, summary, twitter) ' .
'VALUES ("' . $php_data->dateOfBirth . '"' .
',"' . $php_data->company . '"' .
',"' . $php_data->country . '"' .
',"[email protected]"' .
',"' . $php_data->facebook . '"' .
',"' . $php_data->firstName . '"' .
',"' . $php_data->gender . '"' .
',"' . $new_max_id . '"' .
',"' . $php_data->lastName . '"' .
',"' . $php_data->skype . '"' .
',"' . $php_data->summary . '"' .
',"' . $php_data->twitter . '");';
}
So, if there are 10 accounts in DB, a new user will have id=11;
The problem is as follows; The first id is 80; when the number of users
reaches 20 ( last id =100), the next id is never incremented! And new users
keep getting id=100,
although the DB primary key is incremented correctly;
Any ideas?
Thanks in advance!!
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users