Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[MYSQL-PHP] Organize ID-s

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
scearezt
Cheater
Reputation: 0

Joined: 12 Feb 2011
Posts: 46

PostPosted: Sat Apr 02, 2011 3:51 am    Post subject: [MYSQL-PHP] Organize ID-s Reply with quote

Is it possible to organize the ID-s in a specific table?

e.g.:
Code:
ID     NAME     ADDRESS
1       John      Saint Marie st.
2       Julie      Baha st.
3       Adam    Heir st.
4       Joe        Saint Cleveland st.


So I'll delete the ID 3 with a form and PHP and this happens:

Code:
ID     NAME     ADDRESS
1       John      Saint Marie st.
2       Julie      Baha st.
4       Joe        Saint Cleveland st.


That's right but I want to organize the IDs, so this should happen:

Code:
ID     NAME     ADDRESS
1       John      Saint Marie st.
2       Julie      Baha st.
3       Joe        Saint Cleveland st.


Idea how to do it?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Apr 02, 2011 9:13 am    Post subject: Reply with quote

Simply put; don't. Your ID field is being used as a primary key making it 'unique' to whoever owned it. Meaning after it has been used one, it cannot be used again.

Think of it like this, lets say we have your first table:
Code:
ID     NAME     ADDRESS
1       John      Saint Marie st.
2       Julie      Baha st.
3       Adam    Heir st.
4       Joe        Saint Cleveland st.


And lets say this is a shopping cart site or something where people can buy things. Lets say Adam has ordered 4 things online but for some reason you feel the need to delete his account before his order finishes. Now you have:
Code:
ID     NAME     ADDRESS
1       John      Saint Marie st.
2       Julie      Baha st.
3       Joe        Saint Cleveland st.


Which at this point now Joe has Adam's shipment information, order information, and access to any and all of Adams old orders, data, and personal information.

The point of primary keys is for security as well as unique ids. Don't use the ID if you need any specific data other then a unique identifier. If you want a count of the users just use COUNT(*) in your queries instead.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites