1. I can't access rowid values in any of my tables using php. So when I want to delete a record from a webpage, I delete wrong one based on how I am choosing the rowid value.
2. When I delete a record it doesn't change the rowid of all the other records, what is up with that? Is it suppose to do that?
Thanks for youe help
SQLite rowid problem
Moderator: General Moderators
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
Re: SQLite rowid problem
Imagine if you had a game, with all users having a specific id.rohmanovich wrote:1. I can't access rowid values in any of my tables using php. So when I want to delete a record from a webpage, I delete wrong one based on how I am choosing the rowid value.
2. When I delete a record it doesn't change the rowid of all the other records, what is up with that? Is it suppose to do that?
Thanks for youe help
To get to their stats, they'd type in stats.php?id=theirID
Bob wakes up, checks his stats at stats.php?id=47, and then goes to work.
During the day, steve decides your game sucks, and quits (deleting his row).
Bob comes home, goes to check his stats at stats.php?id=47 and finds out it's not HIS stats anymore, it's sally's. Sally was 48 until steve(30) quit, now sally is 47 and bob is 46, but bob doesn't know this, so he emails tech support to see why his account got deleted, and so does every other user with an id greater than 30.
*realizes that was a long example*
Anywho, thats how it's supposed to work.
-
rohmanovich
- Forum Newbie
- Posts: 3
- Joined: Sun Feb 13, 2005 1:55 pm
no. What I am doing is deplaying all contacts(records and their info in table rows. WHen an admin clicks on delete button at the end of every row, that contact and all it's info is deleted. But I can't retrieve the rowid for any of the contacts. Thats the problem. and when I delete a contact it's place is not taken.
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
-
rohmanovich
- Forum Newbie
- Posts: 3
- Joined: Sun Feb 13, 2005 1:55 pm
you are perfectly right by using the sqlite-internal rowid. in each query you must ask the DBMS for the rowid seperately: . then you have it and can use it for whatever you want.
Code: Select all
SELECT rowid, * FROM table